ci: skip PR comment step when workflow_run has no pull request#886
Open
InukaWijerathna wants to merge 1 commit into
Open
ci: skip PR comment step when workflow_run has no pull request#886InukaWijerathna wants to merge 1 commit into
InukaWijerathna wants to merge 1 commit into
Conversation
leave-comment.yml runs after "Generate and Compare Docs", which triggers on both push (to main) and pull_request. Push-triggered runs have no associated PR, so github.event.workflow_run.pull_requests[0] is undefined and the comment step fails with "No issue/pull request in input neither in current context." Guard the job so it only runs when the triggering workflow_run was itself started by a pull_request event. Refs: https://github.com/nodejs/doc-kit/actions/runs/28747289633/job/85240250539
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview The Reviewed by Cursor Bugbot for commit 47649c0. Bugbot is set up for automated code reviews on this repo. Configure here. |
avivkeller
reviewed
Jul 5, 2026
| # Only pull_request-triggered runs have a PR to comment on; runs triggered | ||
| # by a plain push to main (e.g. after a merge) have none, and attempting | ||
| # to comment in that case fails with "No issue/pull request in input". | ||
| if: github.event.workflow_run.event == 'pull_request' |
Member
There was a problem hiding this comment.
Suggested change
| if: github.event.workflow_run.event == 'pull_request' | |
| if: github.event.workflow_run.pull_requests[0].number |
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
leave-comment.ymlruns afterGenerate and Compare Docscompletes viaworkflow_run. That workflow triggers on bothpush(tomain) andpull_request, butleave-comment.ymlunconditionally assumes there's a PR to comment on.For push-triggered runs (e.g. after a merge to
main),github.event.workflow_run.pull_requests[0]isundefined, so theAdd Comment to PRstep fails with:Example failing run: https://github.com/nodejs/doc-kit/actions/runs/28747289633/job/85240250539 (triggered by a push to
main, not a PR).Fix
Guard the
aggregatejob withif: github.event.workflow_run.event == 'pull_request', so it only runs (and only attempts to comment) when the triggering workflow run actually originated from a pull request.Test plan
main, not a PR, matching this fix's guard conditionprettierpre-commit hook (*.ymlfiles are covered by.lintstagedrc.json)workflow_runbehavior only manifests on GitHub's runners, but the fix directly targets the exact condition (workflow_run.event) that caused the observed failure