Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 25, 2025

This PR extends the enforce-pr-conventions action to support GitHub Copilot-generated branch names that follow the copilot/fix* pattern, addressing the need for automated fix branches that don't contain Jira keys in their names.

Problem

Previously, branches like copilot/fix-bug-123 or copilot/fix-aja would be rejected by the PR validation, forcing developers to manually rename Copilot-generated branches to follow traditional naming conventions like fix/JKEY-12345-description.

Solution

Modified the default branch validation regex to include copilot/fix* patterns while maintaining all existing validation requirements:

Before:

^(revert-)|(improvement|fix|feature|test|tmp)\/($JIRA_KEY)-[0-9]+[_-]{1}[A-Za-z0-9._-]+$

After:

^(revert-)|(improvement|fix|feature|test|tmp)\/($JIRA_KEY)-[0-9]+[_-]{1}[A-Za-z0-9._-]+$|^copilot\/fix.*$

Key Features

  • Selective Support: Only copilot/fix* branches are supported (not other copilot branch types)
  • Jira Key Validation: For copilot/fix branches, the Jira key must be present in the PR title (e.g., "JKEY-12345 Fix the bug")
  • Backward Compatibility: All existing branch patterns continue to work exactly as before
  • Flexible Naming: Supports various copilot/fix patterns like copilot/fix-bug-123, copilot/fix-aja, or simply copilot/fix

Examples

Now Accepted:

Branch: copilot/fix-bug-123
PR Title: JKEY-12345 Fix the authentication bug
✅ PASS
Branch: copilot/fix-aja
PR Title: PROJ-67890 Fix AJA integration issue  
✅ PASS

Still Rejected (as intended):

Branch: copilot/feature-123
PR Title: JKEY-12345 New feature
❌ FAIL - Only copilot/fix* supported
Branch: copilot/fix-test
PR Title: Fix without jira key
❌ FAIL - Missing Jira key in PR title

Changes Made

  1. Updated branch validation regex in enforce-pr-conventions action
  2. Enhanced documentation with examples and clarifications about copilot/fix support
  3. Added comprehensive tests to validate new functionality and ensure backward compatibility

Testing

  • All 90 existing tests continue to pass
  • Added 3 new test cases specifically for copilot/fix functionality
  • Validated integration scenarios with various branch and PR title combinations
  • Confirmed zero breaking changes to existing workflows

This change enables seamless integration of GitHub Copilot-generated fix branches while preserving all existing quality controls and validation requirements.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Modify the GitHub Actions workflows and/or scripts that enforce branch and PR conventions:

Locate all places where branch names are validated. This is most likely in the Enforce-PR-conventions workflow, but also check pre-checks (or any other workflows/scripts that validate branch names).

Extend the validation logic to treat branches starting with copilot/fix as valid branch names.

For example, copilot/fix-bug-123 or copilot/fix-aja, should be accepted.

Keep the PR title checks intact. However, since copilot/fix branches won’t carry a Jira key in the branch name, ensure that the Jira key is instead extracted from the PR title when the branch name starts with copilot/fix.

Do not modify any other checks besides branch name validation and the necessary adjustment for Jira key handling.

Update all relevant documentation (e.g., contributing guide, PR conventions docs, workflow README, inline workflow comments) to mention that copilot/fix* branches are now supported.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title Modify the GitHub Actions workflows and/or scripts that enforce branch and PR conventions: Locate all places where branch names are validated. This is most likely in the Enforce-PR-conventions workflow, but also check pre-checks (or any other workflow... Add support for copilot/fix branch naming convention Sep 25, 2025
@Copilot Copilot AI requested a review from souvikpanda99 September 25, 2025 09:43
Copilot finished work on behalf of souvikpanda99 September 25, 2025 09:43
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.

2 participants