Skip to content

Commit 1e4fa2c

Browse files
fix(ci): make finishingbot/seambot/rhodibot workflows actually green (#47)
## Problem The three bot workflows were re-enabled against `gitbot-fleet` in #42, but they were **still red on every run** for two reasons that have nothing to do with the bots themselves (verified from run logs `25977596773`/`777`/`771`): 1. **Step ordering.** `Swatinem/rust-cache` ran *before* the `gitbot-fleet` clone, with `workspaces:` pointing at a path that did not exist yet. rust-cache errored (`The cwd: …/bots/<bot> does not exist!`), the cache never worked, and for **seambot** it left `$RUNNER_TEMP/gitbot-fleet` present so the subsequent `git clone` died with `destination path … already exists and is not an empty directory` (**exit 128**). 2. **Exit-code capture under `set -e`.** `bin … > results.txt 2>&1; echo $? > exit-code.txt` runs under `bash -e`. A non-zero bot exit — which is the *intended gating signal* — aborts the step before the exit-code file is written. The non-`continue-on-error` "Display results" step then hard-fails on the missing file, so the job goes red even though the gate logic was supposed to handle it. ## Fix (all three workflows) - Clone `gitbot-fleet` **before** the cache step; `rm -rf` the target dir first for idempotency. - Capture the exit code without aborting, then re-exit with it: ```bash rc=0 "$BIN" … > <bot>-results.txt 2>&1 || rc=$? echo "$rc" > <bot>-exit-code.txt exit "$rc" ``` This preserves the step's `failure` outcome so the `Fail on …findings/violations` gate still fires on real issues, while the job is green only when the bot is genuinely clean. - Hardened the `Display results` `cat` against a missing file. ## Verification CLI invocations checked against `gitbot-fleet` @ pinned ref `2e0ea3ca` (which **is** gitbot-fleet#150's commit, so `rhodibot check` exists): | bot | invocation | clap definition @ ref | |---|---|---| | finishingbot | `finishing-bot --path <ws> audit` | global `--path` (default `.`) + `Audit` subcommand ✓ | | seambot | `seambot check` | global `--path` (default `.`) + `Check` subcommand ✓ | | rhodibot | `rhodibot check --owner … --repo …` | `Check { owner, repo, format }` (added in #150) ✓ | All three YAML files validated with `yaml.safe_load`. Closes #39 Closes #40 Closes #41 Refs #37 (parent — the three sub-issues complete it) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5b7d226 commit 1e4fa2c

3 files changed

Lines changed: 56 additions & 25 deletions

File tree

.github/workflows/finishingbot.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,23 @@ jobs:
2929
with:
3030
toolchain: stable
3131

32-
- name: Cache dependencies
33-
uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2
34-
with:
35-
workspaces: ${{ runner.temp }}/gitbot-fleet/bots/finishingbot
36-
32+
# Clone BEFORE the rust-cache step: rust-cache needs the workspace
33+
# (Cargo.lock) to exist to key the cache, and cloning into a
34+
# cache-created directory fails with `destination path ... already
35+
# exists and is not an empty directory` (exit 128).
3736
- name: Fetch gitbot-fleet at pinned ref
3837
run: |
38+
rm -rf "$RUNNER_TEMP/gitbot-fleet"
3939
git clone --no-checkout --filter=tree:0 \
4040
https://github.com/hyperpolymath/gitbot-fleet.git \
4141
"$RUNNER_TEMP/gitbot-fleet"
4242
git -C "$RUNNER_TEMP/gitbot-fleet" checkout "$GITBOT_FLEET_REF"
4343
44+
- name: Cache dependencies
45+
uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2
46+
with:
47+
workspaces: ${{ runner.temp }}/gitbot-fleet/bots/finishingbot
48+
4449
- name: Build finishingbot
4550
working-directory: ${{ runner.temp }}/gitbot-fleet/bots/finishingbot
4651
env:
@@ -52,9 +57,15 @@ jobs:
5257
continue-on-error: true
5358
run: |
5459
# The finishingbot crate's binary is `finishing-bot` (hyphenated).
60+
# A non-zero audit is the intended gating signal. Capture it
61+
# without letting `set -e` abort the step before the exit-code
62+
# file is written, then re-exit with it so this step's outcome
63+
# is `failure` and the "Fail on …findings" step below triggers.
64+
rc=0
5565
"$RUNNER_TEMP/gitbot-fleet/bots/finishingbot/target/release/finishing-bot" \
56-
--path "$GITHUB_WORKSPACE" audit > finishingbot-results.txt 2>&1
57-
echo $? > finishingbot-exit-code.txt
66+
--path "$GITHUB_WORKSPACE" audit > finishingbot-results.txt 2>&1 || rc=$?
67+
echo "$rc" > finishingbot-exit-code.txt
68+
exit "$rc"
5869
5970
- name: Display results
6071
if: always()
@@ -65,7 +76,7 @@ jobs:
6576
cat finishingbot-results.txt >> $GITHUB_STEP_SUMMARY
6677
echo '```' >> $GITHUB_STEP_SUMMARY
6778
68-
exit_code=$(cat finishingbot-exit-code.txt)
79+
exit_code=$(cat finishingbot-exit-code.txt 2>/dev/null || echo unknown)
6980
if [ "$exit_code" = "0" ]; then
7081
echo "✅ Release readiness checks passed" >> $GITHUB_STEP_SUMMARY
7182
else

.github/workflows/rhodibot.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,23 @@ jobs:
3030
with:
3131
toolchain: stable
3232

33-
- name: Cache dependencies
34-
uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2
35-
with:
36-
workspaces: ${{ runner.temp }}/gitbot-fleet/bots/rhodibot
37-
33+
# Clone BEFORE the rust-cache step: rust-cache needs the workspace
34+
# (Cargo.lock) to exist to key the cache, and cloning into a
35+
# cache-created directory fails with `destination path ... already
36+
# exists and is not an empty directory` (exit 128).
3837
- name: Fetch gitbot-fleet at pinned ref
3938
run: |
39+
rm -rf "$RUNNER_TEMP/gitbot-fleet"
4040
git clone --no-checkout --filter=tree:0 \
4141
https://github.com/hyperpolymath/gitbot-fleet.git \
4242
"$RUNNER_TEMP/gitbot-fleet"
4343
git -C "$RUNNER_TEMP/gitbot-fleet" checkout "$GITBOT_FLEET_REF"
4444
45+
- name: Cache dependencies
46+
uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2
47+
with:
48+
workspaces: ${{ runner.temp }}/gitbot-fleet/bots/rhodibot
49+
4550
- name: Build rhodibot
4651
working-directory: ${{ runner.temp }}/gitbot-fleet/bots/rhodibot
4752
env:
@@ -56,11 +61,17 @@ jobs:
5661
# read-only workflow token is sufficient (no PAT needed).
5762
GITHUB_TOKEN: ${{ github.token }}
5863
run: |
64+
# A non-zero check is the intended gating signal. Capture it
65+
# without letting `set -e` abort the step before the exit-code
66+
# file is written, then re-exit with it so this step's outcome
67+
# is `failure` and the "Fail on …violations" step below triggers.
68+
rc=0
5969
"$RUNNER_TEMP/gitbot-fleet/bots/rhodibot/target/release/rhodibot" check \
6070
--owner "${{ github.repository_owner }}" \
6171
--repo "${{ github.event.repository.name }}" \
62-
> rhodibot-results.txt 2>&1
63-
echo $? > rhodibot-exit-code.txt
72+
> rhodibot-results.txt 2>&1 || rc=$?
73+
echo "$rc" > rhodibot-exit-code.txt
74+
exit "$rc"
6475
6576
- name: Display results
6677
if: always()
@@ -71,7 +82,7 @@ jobs:
7182
cat rhodibot-results.txt >> $GITHUB_STEP_SUMMARY
7283
echo '```' >> $GITHUB_STEP_SUMMARY
7384
74-
exit_code=$(cat rhodibot-exit-code.txt)
85+
exit_code=$(cat rhodibot-exit-code.txt 2>/dev/null || echo unknown)
7586
if [ "$exit_code" = "0" ]; then
7687
echo "✅ RSR compliance checks passed" >> $GITHUB_STEP_SUMMARY
7788
else

.github/workflows/seambot.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,25 @@ jobs:
3939
with:
4040
toolchain: stable
4141

42-
- name: Cache dependencies
43-
if: steps.check-seam.outputs.has_seam == 'true'
44-
uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2
45-
with:
46-
workspaces: ${{ runner.temp }}/gitbot-fleet/bots/seambot
47-
42+
# Clone BEFORE the rust-cache step: rust-cache needs the workspace
43+
# (Cargo.lock) to exist to key the cache, and cloning into a
44+
# cache-created directory fails with `destination path ... already
45+
# exists and is not an empty directory` (exit 128).
4846
- name: Fetch gitbot-fleet at pinned ref
4947
if: steps.check-seam.outputs.has_seam == 'true'
5048
run: |
49+
rm -rf "$RUNNER_TEMP/gitbot-fleet"
5150
git clone --no-checkout --filter=tree:0 \
5251
https://github.com/hyperpolymath/gitbot-fleet.git \
5352
"$RUNNER_TEMP/gitbot-fleet"
5453
git -C "$RUNNER_TEMP/gitbot-fleet" checkout "$GITBOT_FLEET_REF"
5554
55+
- name: Cache dependencies
56+
if: steps.check-seam.outputs.has_seam == 'true'
57+
uses: Swatinem/rust-cache@ad397744b0d591a723ab90405b7247fac0e6b8db # v2
58+
with:
59+
workspaces: ${{ runner.temp }}/gitbot-fleet/bots/seambot
60+
5661
- name: Build seambot
5762
if: steps.check-seam.outputs.has_seam == 'true'
5863
working-directory: ${{ runner.temp }}/gitbot-fleet/bots/seambot
@@ -65,9 +70,13 @@ jobs:
6570
id: seambot
6671
continue-on-error: true
6772
run: |
73+
# A non-zero check is the intended signal; capture it without
74+
# letting `set -e` abort before the exit-code file is written.
75+
rc=0
6876
"$RUNNER_TEMP/gitbot-fleet/bots/seambot/target/release/seambot" check \
69-
> seambot-results.txt 2>&1
70-
echo $? > seambot-exit-code.txt
77+
> seambot-results.txt 2>&1 || rc=$?
78+
echo "$rc" > seambot-exit-code.txt
79+
exit "$rc"
7180
7281
- name: Display results
7382
if: always() && steps.check-seam.outputs.has_seam == 'true'
@@ -78,7 +87,7 @@ jobs:
7887
cat seambot-results.txt >> $GITHUB_STEP_SUMMARY
7988
echo '```' >> $GITHUB_STEP_SUMMARY
8089
81-
exit_code=$(cat seambot-exit-code.txt)
90+
exit_code=$(cat seambot-exit-code.txt 2>/dev/null || echo unknown)
8291
if [ "$exit_code" = "0" ]; then
8392
echo "✅ All seam checks passed" >> $GITHUB_STEP_SUMMARY
8493
else

0 commit comments

Comments
 (0)