Skip to content

Resolve PR number for workflow_run events and use it for gh comments/reviews#1532

Merged
CatChen merged 1 commit intomainfrom
codex/get-pr-number-from-event
Feb 25, 2026
Merged

Resolve PR number for workflow_run events and use it for gh comments/reviews#1532
CatChen merged 1 commit intomainfrom
codex/get-pr-number-from-event

Conversation

@CatChen
Copy link
Copy Markdown
Owner

@CatChen CatChen commented Feb 25, 2026

Motivation

  • Allow the action to request changes or post comments on PRs even when the workflow is triggered by events other than pull_request (for example workflow_run) by resolving the PR number from the event payload.

Description

  • Add a get-pr-number step that extracts the PR number from github.event.pull_request.number or github.event.workflow_run.pull_requests[0].number and exposes it as pr-number output.
  • Relax checks that required github.event_name == 'pull_request' and instead gate PR actions on steps.get-pr-number.outputs.pr-number != '' so the action can run for non-pull_request events when a PR is present in the payload.
  • Update gh pr review and gh pr comment invocations to pass the explicit PR number argument (e.g. gh pr review "${PR_NUMBER}" -rb ...).
  • Adjust the get-tokens step condition to run token population when changes are detected and request-changes-if-not-clean or push-if-not-clean is enabled regardless of github.event_name.

Testing

  • No automated tests were run for this change.

Codex Task

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Checks from Push as App Test PR #1533

Check Status Time
GitGuardian Security Checks 33s

@github-actions
Copy link
Copy Markdown

Checks from Push Test PR #1534

Check Status Time
GitGuardian Security Checks 33s

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@CatChen CatChen merged commit a3ee329 into main Feb 25, 2026
13 checks passed
@CatChen CatChen deleted the codex/get-pr-number-from-event branch February 25, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support request-changes in detached HEAD checkouts Request changes true causes error

1 participant