Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Restructured the auto-merge workflow to ensure comments are posted reliably in all scenarios, including when the merge step fails with an exception.

Changes:

  • Created a new comment-result job that runs separately from the auto-merge job
  • Job uses if: always() to ensure it runs even when the auto-merge job fails
  • Split comments into two conditional steps based on needs.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 only

Before:

# Comments were steps within the auto-merge job
- name: Comment merge result
  if: always()
  with:
    message: |
      ${{ steps.auto-merge-pr.outcome == 'success' && '✅ **Auto-merge completed successfully!**' || '❌ **Auto-merge failed**' }}
      
      This PR was automatically merged as a small content change.

After:

# Comments are now in a separate job that acts as a catch-all
comment-result:
  name: Comment Merge Result
  needs: [detect-small-changes, auto-merge]
  if: always() && needs.detect-small-changes.outputs.is-small-change == 'true'
  steps:
    - name: Comment merge success
      if: needs.auto-merge.result == 'success'
      with:
        message: |
          ✅ **Auto-merge completed successfully!**
          
          This PR was automatically merged as a small content change.

    - name: Comment merge failure
      if: needs.auto-merge.result == 'failure'
      with:
        message: |
          ❌ **Auto-merge failed** - Please check the workflow logs for details.

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.

Copilot AI changed the title [WIP] Fix auto-merge workflow based on feedback Split auto-merge comment into separate success/failure actions Dec 9, 2025
Copilot AI requested a review from wicksipedia December 9, 2025 23:52

- name: Comment merge failure
uses: mshick/add-pr-comment@v2
if: steps.auto-merge-pr.outcome == 'failure'
Copy link
Member

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

Copy link
Contributor Author

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.result to 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

Copilot AI changed the title Split auto-merge comment into separate success/failure actions Move auto-merge comments to separate job for reliable failure reporting Dec 9, 2025
@wicksipedia wicksipedia marked this pull request as ready for review December 9, 2025 23:59
Copilot AI review requested due to automatic review settings December 9, 2025 23:59
@wicksipedia wicksipedia merged commit e992bc8 into feature/auto-merge-small-changes Dec 10, 2025
Copilot AI requested a review from wicksipedia December 10, 2025 00:00
@wicksipedia wicksipedia deleted the copilot/sub-pr-4108-again branch December 10, 2025 00:00
Copy link
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 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-result job that runs independently using if: 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'
Copy link

Copilot AI Dec 10, 2025

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.

Suggested change
if: needs.auto-merge.result == 'failure'
if: needs.auto-merge.result != 'success'

Copilot uses AI. Check for mistakes.
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