-
Notifications
You must be signed in to change notification settings - Fork 10
Move auto-merge comments to separate job for reliable failure reporting #4379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move auto-merge comments to separate job for reliable failure reporting #4379
Conversation
Co-authored-by: wicksipedia <[email protected]>
|
|
||
| - name: Comment merge failure | ||
| uses: mshick/add-pr-comment@v2 | ||
| if: steps.auto-merge-pr.outcome == 'failure' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot I want this to run even if there is a failure in an earlier step. maybe the 2 actions should be a separate job? that way if any of the steps in the job fail it can be a catch all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've moved the comment steps to a separate comment-result job that:
- Always runs with
if: always()(when is-small-change is true) - Acts as a catch-all for any failures in the auto-merge job
- Uses
needs.auto-merge.resultto determine success vs failure
This ensures the failure comment will post even if the auto-merge job encounters an exception that marks it as failed.
Changes in commit 6a1c86d
Co-authored-by: wicksipedia <[email protected]>
There was a problem hiding this 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 restructures the auto-merge workflow to improve reliability of status reporting by moving comment steps into a separate job that always runs, even when the merge operation fails with an exception.
Key changes:
- Created a new
comment-resultjob that runs independently usingif: always()to ensure execution regardless of the auto-merge job's outcome - Split the single conditional comment step into two separate steps based on success/failure status
- Separated the informational message ("This PR was automatically merged...") to only appear in success scenarios
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - name: Comment merge failure | ||
| uses: mshick/add-pr-comment@v2 | ||
| if: needs.auto-merge.result == 'failure' |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The failure comment condition only checks for failure status, but the auto-merge job could also have cancelled or skipped statuses. Consider handling these additional states to ensure users receive feedback in all non-success scenarios.
Suggested condition:
if: needs.auto-merge.result != 'success'This would catch failure, cancelled, and skipped states, providing feedback whenever the merge doesn't complete successfully.
| if: needs.auto-merge.result == 'failure' | |
| if: needs.auto-merge.result != 'success' |
Restructured the auto-merge workflow to ensure comments are posted reliably in all scenarios, including when the merge step fails with an exception.
Changes:
comment-resultjob that runs separately from theauto-mergejobif: always()to ensure it runs even when the auto-merge job failsneeds.auto-merge.result:Comment merge success- Runs only when merge succeeds, includes "This PR was automatically merged as a small content change."Comment merge failure- Runs only when merge fails, shows error message onlyBefore:
After:
Benefits:
Failure comments now post even if the auto-merge job encounters an exception
Better separation of concerns between merging and status reporting
More reliable feedback to PR authors in all scenarios
Affected routes: N/A (workflow change only)
If adding a new page, I have followed the 📃 New Webpage issue template
If updating the livestream banner, I have tested and followed the steps in Wiki - Testing the live banner
Include Done Video or screenshots
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.