Skip to content

Commit 554f800

Browse files
committed
ci: add gated diag to clang-tidy-bazel-post for reviewdog PR detection
Reviewdog v0.21.0 emits "this is not PullRequest build" and posts nothing on fork-PR runs, even though the synthesized pull_request payload parses fine in a local reproduction. Suspect step-level `env:` cannot override runner-protected GITHUB_EVENT_PATH / GITHUB_EVENT_NAME under `workflow_run`, so reviewdog reads the workflow_run event instead of the synth file. Add a step (gated on `runner.debug == '1'`) that dumps the env reviewdog will see and the effective GITHUB_EVENT_PATH content, plus `-log-level=debug` on the reviewdog invocation under the same gate. Off the debug re-run path the workflow behaves exactly as before. Signed-off-by: Joao Luis Sombrio <sombrio@sombrasoft.dev>
1 parent 44c886d commit 554f800

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/github-actions-clang-tidy-bazel-post.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,40 @@ jobs:
125125
with:
126126
reviewdog_version: latest
127127

128+
- name: Dump reviewdog-visible env and event payload
129+
# Gated on debug re-runs. Reviewdog emits "this is not PullRequest
130+
# build" and posts nothing for fork PRs even though the synthesized
131+
# pull_request payload is well-formed (verified locally against
132+
# reviewdog v0.21.0). Suspect: step-level `env:` cannot override
133+
# runner-protected GITHUB_EVENT_PATH / GITHUB_EVENT_NAME, so reviewdog
134+
# reads the runner's workflow_run event payload instead of our synth.
135+
# This step proves what reviewdog actually sees on the next debug
136+
# re-run.
137+
if: runner.debug == '1'
138+
env:
139+
GITHUB_EVENT_NAME: pull_request
140+
GITHUB_EVENT_PATH: ${{ steps.event.outputs.event_path }}
141+
GITHUB_SHA: ${{ steps.meta.outputs.head_sha }}
142+
GITHUB_REPOSITORY: ${{ steps.meta.outputs.base_repo }}
143+
run: |
144+
echo "::group::GITHUB_* env visible to next step"
145+
env | grep -E '^(GITHUB_|RUNNER_|REVIEWDOG_)' | sort
146+
echo "::endgroup::"
147+
echo "::group::Synth event file location and content"
148+
echo "steps.event.outputs.event_path = ${{ steps.event.outputs.event_path }}"
149+
echo "Effective GITHUB_EVENT_PATH = ${GITHUB_EVENT_PATH}"
150+
if [ -f "${GITHUB_EVENT_PATH}" ]; then
151+
echo "--- file exists, content: ---"
152+
cat "${GITHUB_EVENT_PATH}"
153+
else
154+
echo "::warning::GITHUB_EVENT_PATH file does not exist"
155+
fi
156+
echo "::endgroup::"
157+
echo "::group::Synth file at literal path (should match above)"
158+
SYNTH="${{ steps.event.outputs.event_path }}"
159+
[ -f "${SYNTH}" ] && cat "${SYNTH}" || echo "missing"
160+
echo "::endgroup::"
161+
128162
- name: Run reviewdog
129163
env:
130164
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -133,7 +167,14 @@ jobs:
133167
GITHUB_SHA: ${{ steps.meta.outputs.head_sha }}
134168
GITHUB_REPOSITORY: ${{ steps.meta.outputs.base_repo }}
135169
run: |
170+
# On debug re-runs add reviewdog's own -log-level=debug so the
171+
# cienv detection trace is visible alongside the env dump above.
172+
LOG_FLAGS=()
173+
if [ "${RUNNER_DEBUG}" = "1" ]; then
174+
LOG_FLAGS+=(-log-level=debug)
175+
fi
136176
reviewdog \
177+
"${LOG_FLAGS[@]}" \
137178
-efm="%E%f:%l:%c: error: %m" \
138179
-efm="%W%f:%l:%c: warning: %m" \
139180
-name="clang-tidy" \

0 commit comments

Comments
 (0)