Skip to content

Commit af04a20

Browse files
committed
ci: post sticky PR comment with fallow audit findings
Reviewers shouldn't have to dig through CI logs to see what fallow flagged. With this change, on every PR the fallow job posts (or updates) a sticky comment containing the full audit report formatted as a collapsible markdown table. The comment uses fallow's built-in `pr-comment-github` format, which already emits a `<!-- fallow-id: fallow-results -->` sentinel. `marocchino/sticky-pull-request-comment@v2.9.1` matches that header so each run replaces the previous comment instead of stacking new ones. The job now runs in three steps: 1. Run `fallow audit ... --format pr-comment-github` with `continue-on-error: true` so the comment posts even when the audit fails. Exit code is captured. 2. Post (or update) the sticky comment with the captured output. 3. Re-emit the audit exit code so the job still fails-the-build on new findings. Bumps the workflow's `pull-requests` permission from read to write, needed for the sticky-comment poster to call the issues API.
1 parent 7f10c63 commit af04a20

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ name: CI
22

33
permissions:
44
contents: read
5-
pull-requests: read
5+
# `pull-requests: write` is needed for the `Fallow audit` job to post the
6+
# sticky comment summarizing findings. All read-only consumers (paths-filter,
7+
# semantic-pr-title) work fine with this scope.
8+
pull-requests: write
69

710
on:
811
pull_request:
@@ -86,6 +89,9 @@ jobs:
8689
# the changed files. The default `--gate new-only` means existing legacy
8790
# findings don't fail the build — only NEW issues introduced by the PR do.
8891
# This stops bleeding while letting incremental cleanup land separately.
92+
#
93+
# On findings, the job posts (or updates) a sticky comment on the PR so
94+
# reviewers see the full list inline instead of digging through CI logs.
8995
fallow:
9096
name: Fallow audit
9197
needs: changes
@@ -103,7 +109,30 @@ jobs:
103109
node-version: 22
104110
# Pinned version — bumps land via a deliberate PR. Keep in sync with
105111
# the version that produced the current `.fallowrc.jsonc` config.
106-
- run: npx -y fallow@2.75.0 audit --base origin/main --fail-on-issues
112+
- name: Run fallow audit
113+
id: audit
114+
# Capture markdown output for the PR comment; let the step finish so
115+
# we can post the comment even when the audit fails. Re-emit the exit
116+
# status from the final step.
117+
continue-on-error: true
118+
run: |
119+
npx -y fallow@2.75.0 audit --base origin/main --fail-on-issues \
120+
--format pr-comment-github \
121+
> /tmp/fallow-comment.md
122+
echo "exit_code=$?" >> "$GITHUB_OUTPUT"
123+
- name: Post sticky comment on PR
124+
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.1
125+
with:
126+
# Matches the `<!-- fallow-id: fallow-results -->` sentinel that
127+
# fallow's pr-comment-github format already includes, so each run
128+
# updates the same comment instead of creating new ones.
129+
header: fallow-results
130+
path: /tmp/fallow-comment.md
131+
- name: Fail if audit found issues
132+
if: steps.audit.outputs.exit_code != '0'
133+
run: |
134+
echo "::error::Fallow audit found new issues — see the PR comment above for details."
135+
exit 1
107136
108137
format:
109138
name: Format

0 commit comments

Comments
 (0)