From 17c89d38fcad09f92566477db4b1c879b164f76d Mon Sep 17 00:00:00 2001 From: Pranav Jain Date: Tue, 16 Jun 2026 22:37:27 +0000 Subject: [PATCH] fix(gha): fix invalid if condition on reusable workflow caller job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitHub Actions does not support bare if: conditions on jobs that use `uses:` (reusable workflow callers) when the expression references github.event context — it fails with "workflow was not found" during parse. Replace the bare if: on the claude-code job with a gate job (check-author) that evaluates the author_association and emits an output. The reusable workflow job then uses needs: + a safe needs..outputs context in its if:, which GitHub Actions does support on caller jobs. Ticket: WAL-1545 Session-Id: 370d5696-0241-42b2-9607-273a4cd2ed99 Task-Id: d63c168d-4c13-4704-bf9e-61f2c30b9985 --- .github/workflows/claude-code.yaml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/claude-code.yaml b/.github/workflows/claude-code.yaml index 3d3fc1e..b0173cf 100644 --- a/.github/workflows/claude-code.yaml +++ b/.github/workflows/claude-code.yaml @@ -15,11 +15,25 @@ on: types: [created, edited] jobs: + check-author: + name: Check commenter is org member + runs-on: ubuntu-latest + outputs: + allowed: ${{ steps.check.outputs.allowed }} + steps: + - id: check + run: | + ASSOC="${{ github.event.comment.author_association }}" + if [[ "$ASSOC" == "OWNER" || "$ASSOC" == "MEMBER" ]]; then + echo "allowed=true" >> "$GITHUB_OUTPUT" + else + echo "allowed=false" >> "$GITHUB_OUTPUT" + fi + claude-code: name: Invoke Claude Code AI assistant - if: | - github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'MEMBER' + needs: check-author + if: needs.check-author.outputs.allowed == 'true' uses: BitGo/github-ai-assistant/.github/workflows/claude.yaml@v1 with: code_review_prompt_path: .github/prompts/code-review.md