Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 7, 2025

Closes #

The status-checks workflow only ran on pull request events, preventing it from overriding integration test statuses when PRs enter the merge queue.

Changelog

Changed

  • status-checks.yml now triggers on merge_group events (scoped to main branch)
  • Workflow uses a single github-ui job with conditional steps:
    • Token generation step runs once for both event types
    • "Override status checks for pull request" step runs conditionally when event is pull_request
    • "Override status checks for merge queue" step runs conditionally when event is merge_group
  • Pull request step uses environment variables ($PR_NUMBER and $SHA) for cleaner code and gets timeline event ID for the label
  • Merge queue step extracts PR number from head_ref (format: refs/heads/gh-readonly-queue/main/pr-{number}-{sha}), validates extraction, and always passes status checks without label verification
  • Repository URL now uses github.repository context variable instead of hardcoded value

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; workflow-only change, no user-facing impact

Testing & Reviewing

The workflow will trigger in two scenarios:

  • Pull Request: When a PR has the integration-tests: skipped manually label, it overrides status checks
  • Merge Queue: Automatically passes status checks for any PR in the merge queue, regardless of labels

The single job structure with conditional steps allows for shared token generation while maintaining clean separation of logic between pull request and merge queue events. Environment variables are used for better code readability and maintainability.

Merge checklist

Original prompt

Update the status-checks.yml workflow to also work with the merge queue trigger/event


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@changeset-bot
Copy link

changeset-bot bot commented Nov 7, 2025

⚠️ No Changeset found

Latest commit: 0539ce9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI and others added 4 commits November 7, 2025 17:59
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
…epository

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copilot AI changed the title [WIP] Update status-checks.yml for merge queue trigger Add merge_group trigger support to status-checks workflow Nov 7, 2025
Copilot AI requested a review from joshblack November 7, 2025 18:06
Copilot finished work on behalf of joshblack November 7, 2025 18:06
Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot can you split this logic into two jobs, one that runs if it's merge queue and one that runs if it's a pull request, instead of combining into a single job

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot can you split this logic into two jobs, one that runs if it's merge queue and one that runs if it's a pull request, instead of combining into a single job

Done! Split into two separate jobs: github-ui-pull-request for pull request events and github-ui-merge-queue for merge queue events. Each job now has its own dedicated logic without conditional branching. Commit: 8c0dbfa

Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot instead of two separate jobs actually can you split these into two separate steps under the github-ui job that run conditionally based on if they are a pull request or merge queue

Copilot AI requested a review from joshblack November 7, 2025 18:18
Copilot finished work on behalf of joshblack November 7, 2025 18:18
Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot instead of two separate jobs actually can you split these into two separate steps under the github-ui job that run conditionally based on if they are a pull request or merge queue

Done! Refactored to a single github-ui job with two conditional steps: "Override status checks for pull request" runs when event_name == 'pull_request' and "Override status checks for merge queue" runs when event_name == 'merge_group'. The token generation step is now shared between both. Commit: 59048df

Copilot finished work on behalf of joshblack November 7, 2025 18:25
run: |
# Get the timeline event ID for the label being added
EVENT_ID=$(gh api "/repos/primer/react/issues/$PR_NUMBER/timeline" \
EVENT_ID=$(gh api "/repos/primer/react/issues/${{ github.event.pull_request.number }}/timeline" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot refactor this to use $PR_NUMBER as an env variable set to this value

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! Refactored to use $PR_NUMBER as an environment variable. Commit: f71e44b

fi
gh api -X POST "/repos/primer/react/statuses/$SHA" \
gh api -X POST "/repos/primer/react/statuses/${{ github.event.pull_request.head.sha }}" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot refactor this to use $SHA as an env variable set to this value

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! Refactored to use $SHA as an environment variable. Commit: f71e44b

-f target_url="$TARGET_URL"
gh api -X POST "/repos/primer/react/statuses/$SHA" \
gh api -X POST "/repos/primer/react/statuses/${{ github.event.pull_request.head.sha }}" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot refactor this to use $SHA as an env variable set to this value

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! Refactored to use $SHA as an environment variable. Commit: f71e44b

Comment on lines 58 to 78
# Extract PR number from head_ref
# Format: refs/heads/gh-readonly-queue/main/pr-123-abc123
PR_NUMBER=$(echo "${{ github.event.merge_group.head_ref }}" | sed -n 's/^refs\/heads\/gh-readonly-queue\/[^\/]*\/pr-\([0-9]*\)-.*/\1/p')
# Validate PR_NUMBER extraction
if [ -z "$PR_NUMBER" ]; then
echo "Error: Failed to extract PR number from head_ref: ${{ github.event.merge_group.head_ref }}"
exit 1
fi
# Check if the PR has the required label
HAS_LABEL=$(gh api "/repos/primer/react/issues/$PR_NUMBER" \
--jq '[.labels[].name] | contains(["integration-tests: skipped manually"])')
if [ "$HAS_LABEL" != "true" ]; then
echo "PR #$PR_NUMBER does not have the required label. Skipping status override."
exit 0
fi
# Use the PR URL as the target URL
TARGET_URL="https://github.com/${{ github.repository }}/pull/$PR_NUMBER"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove this, we always want this check to pass when in merge queue

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! Removed the label check for merge queue - the workflow now always passes status checks when triggered by merge_group events. Commit: f71e44b

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copilot AI requested a review from joshblack November 7, 2025 18:38
Copilot finished work on behalf of joshblack November 7, 2025 18:38
@joshblack joshblack marked this pull request as ready for review November 10, 2025 17:03
@joshblack joshblack requested a review from a team as a code owner November 10, 2025 17:03
Copilot AI review requested due to automatic review settings November 10, 2025 17:03
@joshblack joshblack added the skip changeset This change does not need a changelog label Nov 10, 2025
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 adds support for the merge queue feature to the status-checks workflow. When a PR with the label "integration-tests: skipped manually" enters the merge queue, this workflow will automatically override the required status checks.

Key Changes

  • Added merge_group event trigger to allow the workflow to run during merge queue operations
  • Updated job-level conditional to run for both labeled pull requests and all merge queue events
  • Split the status check override logic into separate steps for pull requests and merge queue with appropriate conditionals

merge_group:
branches:
- main
types: [checks_requested]
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The types array uses bracket notation [checks_requested] while other workflows in the repository (ci.yml and reports.yml) use flow sequence notation - checks_requested for consistency. Consider changing to flow sequence notation to match the project's style.

Suggested change
types: [checks_requested]
types:
- checks_requested

Copilot uses AI. Check for mistakes.
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand this, but happy to follow your lead on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants