[no-ci] Fix race condition in PR metadata check workflow#1874
Merged
leofang merged 3 commits intoNVIDIA:mainfrom Apr 7, 2026
Merged
[no-ci] Fix race condition in PR metadata check workflow#1874leofang merged 3 commits intoNVIDIA:mainfrom
leofang merged 3 commits intoNVIDIA:mainfrom
Conversation
The workflow reads assignees, labels, and milestone from the event payload, which is a snapshot taken at trigger time. When a PR is opened, the `opened` event fires before labels/milestone/assignee are fully applied, causing the check to fail with stale data. Fix by fetching live PR data via `gh api` instead of relying on the event payload. The downstream validation logic is unchanged.
Contributor
cpcloud
reviewed
Apr 7, 2026
Address review feedback: use gh's built-in --jq flag to extract only assignees, labels, and milestone from the API response, avoiding unnecessary processing of the full PR payload.
cpcloud
reviewed
Apr 7, 2026
Address review feedback: use the higher-level `gh pr view` command with --json and --jq instead of constructing the raw API URL.
rparolin
approved these changes
Apr 7, 2026
Member
Author
|
As discussed in the meeting, I'll merge this after #1871. |
Member
Author
Member
Author
|
/ok to test f1850e0 |
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
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.
Summary
The
pr-metadata-checkworkflow reads assignees, labels, and milestone fromgithub.event.pull_request, which is a snapshot taken at event trigger time. When a PR is opened, theopenedevent fires before labels/milestone/assignee are fully applied (e.g. by automation or rapid manual edits), causing the check to fail with stale data. Re-running the job doesn't help because it re-uses the same stale event payload.This PR fixes the race by fetching live PR data via
gh apiinstead of relying on the event payload. The downstream validation logic is unchanged.What changed
github.event.pull_request.{assignees,labels,milestone}env vars with a singlegh apicall that fetches current PR state--jqto filter the API response to only the 3 fields needed (assignees, labels, milestone)PR_NUMBER,GH_REPO, andGH_TOKENenv vars to support the API callTest plan
-- Leo's bot