|
9 | 9 | types: [created] |
10 | 10 |
|
11 | 11 | jobs: |
| 12 | + # Parses the command, checks auth, handles skip, and outputs whether to run the audit |
12 | 13 | handle-command: |
13 | | - # Only run on PR comments containing a vault-audit command |
14 | 14 | if: | |
15 | 15 | github.event.issue.pull_request != null && |
16 | 16 | ( |
|
23 | 23 | issues: write |
24 | 24 | pull-requests: write |
25 | 25 | statuses: write |
| 26 | + outputs: |
| 27 | + run_audit: ${{ steps.cmd.outputs.type == 'run' && steps.auth.outputs.authorized == 'true' }} |
| 28 | + head_sha: ${{ steps.pr.outputs.head_sha }} |
| 29 | + base_sha: ${{ steps.pr.outputs.base_sha }} |
26 | 30 |
|
27 | 31 | steps: |
28 | 32 | - name: Check commenter authorization |
@@ -101,15 +105,17 @@ jobs: |
101 | 105 | gh pr comment ${{ github.event.issue.number }} \ |
102 | 106 | --body "🔍 Vault audit triggered by @${{ github.event.comment.user.login }} — running now. Results will appear as a new comment when complete." |
103 | 107 |
|
104 | | - - name: Trigger vault audit |
105 | | - if: steps.cmd.outputs.type == 'run' |
106 | | - uses: smartcontractkit/cre-docs/.github/workflows/vault-audit.yml@main |
107 | | - with: |
108 | | - pr_number: ${{ github.event.issue.number }} |
109 | | - head_sha: ${{ steps.pr.outputs.head_sha }} |
110 | | - base_sha: ${{ steps.pr.outputs.base_sha }} |
111 | | - chainlink_repo: ${{ github.repository }} |
112 | | - secrets: |
113 | | - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
114 | | - CRE_DOCS_TOKEN: ${{ secrets.CRE_DOCS_TOKEN }} |
115 | | - CHAINLINK_TOKEN: ${{ github.token }} |
| 108 | + # Reusable workflows must be called as a top-level job, not a step |
| 109 | + run-audit: |
| 110 | + needs: handle-command |
| 111 | + if: needs.handle-command.outputs.run_audit == 'true' |
| 112 | + uses: smartcontractkit/cre-docs/.github/workflows/vault-audit.yml@main |
| 113 | + with: |
| 114 | + pr_number: ${{ github.event.issue.number }} |
| 115 | + head_sha: ${{ needs.handle-command.outputs.head_sha }} |
| 116 | + base_sha: ${{ needs.handle-command.outputs.base_sha }} |
| 117 | + chainlink_repo: ${{ github.repository }} |
| 118 | + secrets: |
| 119 | + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
| 120 | + CRE_DOCS_TOKEN: ${{ secrets.CRE_DOCS_TOKEN }} |
| 121 | + CHAINLINK_TOKEN: ${{ github.token }} |
0 commit comments