Skip to content

Add support for --commit-message option in push:artifact.#1987

Draft
paweldxm wants to merge 1 commit intoacquia:mainfrom
paweldxm:feature/custom-commit-message
Draft

Add support for --commit-message option in push:artifact.#1987
paweldxm wants to merge 1 commit intoacquia:mainfrom
paweldxm:feature/custom-commit-message

Conversation

@paweldxm
Copy link
Copy Markdown

Motivation
There was no way to provide a custom commit message when using push:artifact.
In some CI/CD and release workflows, it is important to control the artifact commit message (e.g. for traceability, compliance, or linking deployments to external systems).

This change introduces a safe and optional way to override the default commit message via a CLI option.

Proposed changes
Proposed changes

  • Adds a new CLI option --commit-message to push:artifact

  • Allows users to override the default artifact commit message

  • Adds proper sanitization for user input: removes control characters, enforces single-line commit message, limits message length (255 chars), falls back to default message if input is empty after sanitization

  • Preserves existing behavior:

  1. ENV fallback (ACLI_PUSH_ARTIFACT_COMMIT_MSG)
  2. default automated message remains unchanged

This change is fully backward compatible and does not require any migration steps.

Alternatives considered

  • Relying only on environment variable (ACLI_PUSH_ARTIFACT_COMMIT_MSG) - rejected because CLI option is more explicit and CI-friendly
  • Allowing raw commit message without sanitization - rejected due to security/log injection risks and Git commit message hygiene
  • Extending existing ENV-only approach - rejected to improve usability and clarity for users and automation tools

Testing steps
Follow the contribution guide
to set up the environment or use a pre-built acli.phar.

If running from source, clear cache:

./bin/acli ckc

Build artifact with default behavior:

acli push:artifact

→ verify default commit message is unchanged

Test CLI override:

acli push:artifact --commit-message="Custom deployment message"

→ verify commit message reflects provided value

Test sanitization:

acli push:artifact --commit-message=$'bad\nmessage\x00test'

→ verify message is single-line and clean

Test fallback behavior:

acli push:artifact --commit-message=""

→ verify default message is used

@paweldxm paweldxm force-pushed the feature/custom-commit-message branch from cbd61c9 to 6606d4f Compare April 23, 2026 14:12
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 36.84211% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.22%. Comparing base (c864c3f) to head (6606d4f).

Files with missing lines Patch % Lines
src/Command/Push/PushArtifactCommand.php 36.84% 12 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1987      +/-   ##
============================================
- Coverage     92.35%   92.22%   -0.14%     
- Complexity     1953     1956       +3     
============================================
  Files           123      123              
  Lines          7168     7186      +18     
============================================
+ Hits           6620     6627       +7     
- Misses          548      559      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown

Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/1987/acli.phar

curl -OL https://acquia-cli.s3.amazonaws.com/build/pr/1987/acli.phar
chmod +x acli.phar

@paweldxm paweldxm changed the title Add support for --commit-message option in push:artifact. This improves CI/CD integration flexibility while maintaining safe commit hygiene. Add support for --commit-message option in push:artifact. Apr 23, 2026
@paweldxm paweldxm marked this pull request as draft April 23, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant