ci: overwrite runner event file so reviewdog detects fork PRs#10589
Open
openroad-ci wants to merge 1 commit into
Open
Conversation
clang-tidy-bazel-post posted no review comments on fork PRs: reviewdog exited with "this is not PullRequest build" on every run (PRs The-OpenROAD-Project#10550, The-OpenROAD-Project#10553, The-OpenROAD-Project#10226, The-OpenROAD-Project#10565). Root cause, confirmed via a debug-gated env dump (public run 26681282929 attempt 2 on PR The-OpenROAD-Project#10565): GITHUB_EVENT_PATH and GITHUB_EVENT_NAME are runner-protected default env vars. The step-level `env:` override we used to point reviewdog at a synthesized pull_request payload is silently dropped -- the runner re-injects the real workflow_run event file, whose payload carries no usable pull_request (its pull_requests[] is empty for fork PRs). reviewdog's cienv parses that file, sees PullRequest == 0, and bails before posting. The synthesized side file was correct but never read. Fix: stop trying to override the env pointer (a no-op) and instead overwrite the runner's event file in place with the synthesized pull_request payload. reviewdog's cienv only parses the file at GITHUB_EVENT_PATH (it does not check GITHUB_EVENT_NAME), so the overwrite alone makes detection succeed. Owner/repo/head-sha all come from the payload we write, so the now-dead GITHUB_* overrides on the reviewdog step are removed. Nothing after the synth step depends on the original workflow_run event, so overwriting it is safe. The debug-gated diagnostic step (runner.debug == '1') is kept and updated to verify the event file now holds the synthesized payload. Signed-off-by: Joao Luis Sombrio <sombrio@sombrasoft.dev>
Contributor
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
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
clang-tidy-bazel-postposted no review comments on fork PRs — reviewdog exited withreviewdog: this is not PullRequest build.on every run (#10550, #10553, #10226, #10565).Root cause (confirmed)
GITHUB_EVENT_PATHandGITHUB_EVENT_NAMEare runner-protected default env vars. The step-levelenv:override we used to point reviewdog at a synthesizedpull_requestpayload is silently dropped — the runner re-injects the realworkflow_runevent file, whose payload has no usablepull_request(itspull_requests[]is empty for fork PRs). reviewdog'scienvparses that file, seesPullRequest == 0, and bails before posting. Our synthesized side file was correct but never read.Proof, from the debug-gated diagnostic step on public run 26681282929 attempt 2 (PR #10565) — the step set both overrides, yet
envinside it reported:and that runner file carried
"pull_requests": [].Fix
Stop overriding the env pointer (a no-op). Instead overwrite the runner's event file in place with the synthesized
pull_requestpayload. reviewdog'scienvonly parses the file atGITHUB_EVENT_PATH(it does not checkGITHUB_EVENT_NAME), so the overwrite alone makes detection succeed. Owner/repo/head-sha all come from the payload we write, so the now-deadGITHUB_*overrides on the reviewdog step are removed. Nothing after the synth step depends on the originalworkflow_runevent, so overwriting it is safe.The debug-gated diagnostic step (
runner.debug == '1') is kept and updated to verify the event file now holds the synthesized payload.Test plan