Skip to content

Fix commit-title-prefix being stripped by git am - #2337

Merged
pelikhan merged 3 commits into
mainfrom
copilot/investigate-commit-title-prefix
Oct 24, 2025
Merged

Fix commit-title-prefix being stripped by git am#2337
pelikhan merged 3 commits into
mainfrom
copilot/investigate-commit-title-prefix

Conversation

CopilotAI commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

The commit-title-prefix configuration in safe-outputs.push-to-pull-request-branch was not appearing in final commit messages. Git am strips all bracketed prefixes matching [PATCH <anything>] from Subject lines, so [skip-ci] was being removed along with [PATCH].

Changes

  • Normalize bracketed prefixes to colon format before applying patches

    • [skip-ci] skip-ci:
    • [bot] bot:
    • Non-bracketed prefixes like chore: pass through unchanged
  • Add comprehensive test coverage with 5 test cases for edge cases

Implementation

// Extract content from brackets and convert to colon formatletnormalizedPrefix=commitTitlePrefix;if(normalizedPrefix.startsWith('[')&&normalizedPrefix.includes(']')){constbracketContent=normalizedPrefix.match(/^\[([^\]]+)\]/);if(bracketContent){constafterBracket=commitTitlePrefix.substring(commitTitlePrefix.indexOf(']')+1);normalizedPrefix=bracketContent[1]+':';if(afterBracket){normalizedPrefix+=afterBracket;}else{normalizedPrefix+=' ';}}}

Result: Subject: [PATCH] skip-ci: Add changeset... → git am → skip-ci: Add changeset...

Original prompt

Investigate why the title of the commit did not start with "[skip-ci]" since this is the "commit-title-prefix" specified on the safe outputs push-to-pull-request-branch configuration in the changeset generator workflow.
The run logs are available at https://github.com/githubnext/gh-aw/actions/runs/18793919264/job/53630122438


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

CopilotAIand others added 2 commits October 24, 2025 23:06
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title [WIP] Investigate missing [skip-ci] in commit titleFix commit-title-prefix being stripped by git amOct 24, 2025
CopilotAI requested a review from pelikhanOctober 24, 2025 23:16
@pelikhan
pelikhan marked this pull request as ready for review October 24, 2025 23:18
CopilotAI review requested due to automatic review settings October 24, 2025 23:18
@github-actions

Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where commit title prefixes in bracketed format (e.g., [skip-ci]) were being stripped by git am during patch application. The issue occurred because git am removes all [PATCH <anything>] patterns from Subject lines, inadvertently removing user-specified prefixes like [skip-ci] along with the [PATCH] marker.

Key Changes:

  • Added prefix normalization logic to convert bracketed prefixes (e.g., [skip-ci]) to colon format (e.g., skip-ci:) before applying patches
  • Implemented comprehensive test coverage with 5 test cases covering various edge cases
  • Updated all workflow lock files to use the normalized prefix format

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
pkg/workflow/js/push_to_pull_request_branch.cjsImplements the core normalization logic that converts bracketed prefixes to colon format
pkg/workflow/js/push_to_pull_request_branch.test.cjsAdds 5 comprehensive test cases covering different prefix formats and edge cases
.github/workflows/tidy.lock.ymlUpdates workflow to use normalized prefix logic and pins action versions to specific commits
.github/workflows/poem-bot.lock.ymlUpdates workflow to use normalized prefix logic and pins action versions to specific commits
.github/workflows/mergefest.lock.ymlUpdates workflow to use normalized prefix logic and pins action versions to specific commits
.github/workflows/changeset-generator.firewall.lock.ymlUpdates workflow to use normalized prefix logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpkg/workflow/js/push_to_pull_request_branch.cjs
@pelikhan
pelikhan enabled auto-merge (squash) October 24, 2025 23:19
@pelikhan
pelikhan merged commit e834e7c into mainOct 24, 2025
55 checks passed
@pelikhan
pelikhan deleted the copilot/investigate-commit-title-prefix branch October 24, 2025 23:19
Sign up for freeto 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.

3 participants

@pelikhan