Skip to content

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

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

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

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 24, 2025

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 format
let normalizedPrefix = commitTitlePrefix;
if (normalizedPrefix.startsWith('[') && normalizedPrefix.includes(']')) {
  const bracketContent = normalizedPrefix.match(/^\[([^\]]+)\]/);
  if (bracketContent) {
    const afterBracket = 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.

Copilot AI and 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>
Copilot AI changed the title [WIP] Investigate missing [skip-ci] in commit title Fix commit-title-prefix being stripped by git am Oct 24, 2025
Copilot AI requested a review from pelikhan October 24, 2025 23:16
@pelikhan pelikhan marked this pull request as ready for review October 24, 2025 23:18
Copilot AI 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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
File Description
pkg/workflow/js/push_to_pull_request_branch.cjs Implements the core normalization logic that converts bracketed prefixes to colon format
pkg/workflow/js/push_to_pull_request_branch.test.cjs Adds 5 comprehensive test cases covering different prefix formats and edge cases
.github/workflows/tidy.lock.yml Updates workflow to use normalized prefix logic and pins action versions to specific commits
.github/workflows/poem-bot.lock.yml Updates workflow to use normalized prefix logic and pins action versions to specific commits
.github/workflows/mergefest.lock.yml Updates workflow to use normalized prefix logic and pins action versions to specific commits
.github/workflows/changeset-generator.firewall.lock.yml Updates workflow to use normalized prefix logic

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

Comment thread pkg/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 main Oct 24, 2025
55 checks passed
@pelikhan pelikhan deleted the copilot/investigate-commit-title-prefix branch October 24, 2025 23:19
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.

3 participants