ci: split clang-tidy-bazel into pull_request + workflow_run stages#10527
Closed
openroad-ci wants to merge 1 commit into
Closed
Conversation
The split workflow removed the inline reviewdog step from stage A, which silently downgraded enforcement: stage A now exits 0 even when PR-diff clang-tidy findings exist, so branch protection on the `clang-tidy-bazel` check passes and merges are no longer blocked on lint findings. Stage B's `-fail-level=any` runs in workflow_run context where the resulting check binds to the default-branch SHA, not the PR head, so it cannot satisfy a required PR check. Restore the old behaviour: - Stage A re-adds reviewdog (set up + run with -reporter=local -filter-mode=added -fail-level=any). The fork-PR token is read-only, but `-reporter=local` only needs the filesystem and a `-diff` command, so this works in all PR contexts. Step is positioned AFTER the artifact upload so the post workflow still has the findings to post as review comments even when this step exits non-zero. - Stage B's guard relaxes from `conclusion == 'success'` to `conclusion != 'cancelled'`, so it still runs when Stage A's check step failed (artifact is uploaded before that fail step). 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-bazelinto two stages so reviewdog can post review comments on fork PRs on the public repo, where thepull_requesttoken is read-only.clang-tidy-bazel) keeps the bazel--config=lintbuild and uploadsclang-tidy.txt+pr-meta.txtas an artifact. No write permissions.clang-tidy-bazel-post) runs onworkflow_runin base-repo context with a writable token. Downloads the artifact, validatespr-meta.txtfields against a strict regex allowlist, synthesizes apull_requestevent JSON (becauseworkflow_run.pull_requests[]is empty for fork PRs), then runs reviewdog with-reporter=github-pr-review.Why
Single-stage
pull_requestworkflow can't post reviewdog reviews on fork PRs — GitHub gives those runs a read-onlyGITHUB_TOKENregardless ofpermissions:, soPOST /pulls/N/reviewsreturned 403 and reviewdog exited 1 (see failed run on public tier). This mirrors the legacy two-stageclang-tidy-review/clang-tidy-review-postsetup that solved the same problem before the bazel-based rewrite landed.Security
pr-meta.txtis parsed with a strict allowlist (pr_numbernumeric, SHAs hex-40, repo slugs^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$).BAZEL_CACHE_PASSWORDis not available there (consistent with prior behaviour).Test plan
workflow_run completedand posts a review on the in-org PR.conclusion != 'success'.