Update pre-commit fix workflow to automatically run on GitHub Copilot PRs#698
Merged
Merged
Conversation
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Free review on us!CodeRabbit is offering free reviews until Wed Oct 08 2025 to showcase some of the refinements we've made. Comment |
Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Please update the Pre-commit fix GitHub action to work on pull requests from copilot
Update pre-commit fix workflow to automatically run on GitHub Copilot PRs
Oct 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The pre-commit fix GitHub Action was only configured to run via manual
workflow_dispatchtrigger. This meant that pull requests created by GitHub Copilot (which follow thecopilot/*branch naming pattern) did not automatically benefit from pre-commit hook fixes, requiring manual intervention to apply formatting and linting corrections.Solution
Updated
.github/workflows/pre-commit.ymlto automatically trigger on pull requests from Copilot branches while maintaining backward compatibility with manual runs.Key Changes
Added
pull_request_targettrigger - The workflow now triggers automatically when Copilot PRs are opened, synchronized, or reopenedCopilot branch detection - Added logic to identify branches matching the
copilot/*pattern, ensuring the workflow only runs on Copilot-generated PRs (not on all PRs)Smart checkout and push - Updated the workflow to properly check out PR head branches and push fixes back to the correct branch reference, handling both PR and manual trigger contexts
Conditional execution - All workflow steps now conditionally execute based on branch detection, preventing unnecessary runs on non-Copilot PRs
How It Works
copilot/*branchesThis implementation follows the same pattern used in
enforce-issue-linked-pr.yml, ensuring consistency across repository workflows and improving the developer experience when working with GitHub Copilot.Testing
The workflow has been validated for:
workflow_dispatchtriggerOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.