Skip to content

Commit e265caa

Browse files
committed
Fixed syntax for workflow
1 parent e51f223 commit e265caa

2 files changed

Lines changed: 36 additions & 24 deletions

File tree

.github/workflows/vault-audit-commands.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
types: [created]
1010

1111
jobs:
12+
# Parses the command, checks auth, handles skip, and outputs whether to run the audit
1213
handle-command:
13-
# Only run on PR comments containing a vault-audit command
1414
if: |
1515
github.event.issue.pull_request != null &&
1616
(
@@ -23,6 +23,10 @@ jobs:
2323
issues: write
2424
pull-requests: write
2525
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 }}
2630

2731
steps:
2832
- name: Check commenter authorization
@@ -101,15 +105,17 @@ jobs:
101105
gh pr comment ${{ github.event.issue.number }} \
102106
--body "🔍 Vault audit triggered by @${{ github.event.comment.user.login }} — running now. Results will appear as a new comment when complete."
103107
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 }}

.github/workflows/vault-audit-thread-resolved.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ on:
99
types: [resolved]
1010

1111
jobs:
12-
check-overrides:
12+
check-auth:
1313
runs-on: ubuntu-latest
1414
permissions:
15-
statuses: write
1615
pull-requests: read
16+
outputs:
17+
authorized: ${{ steps.auth.outputs.authorized }}
1718

1819
steps:
1920
- name: Check resolver authorization
@@ -31,12 +32,17 @@ jobs:
3132
echo "authorized=false" >> $GITHUB_OUTPUT
3233
fi
3334
34-
- name: Run override check
35-
if: steps.auth.outputs.authorized == 'true'
36-
uses: smartcontractkit/cre-docs/.github/workflows/vault-audit-override-check.yml@main
37-
with:
38-
pr_number: ${{ github.event.pull_request.number }}
39-
head_sha: ${{ github.event.pull_request.head.sha }}
40-
chainlink_repo: ${{ github.repository }}
41-
secrets:
42-
CHAINLINK_TOKEN: ${{ github.token }}
35+
# Reusable workflows must be called as a top-level job, not a step
36+
run-override-check:
37+
needs: check-auth
38+
if: needs.check-auth.outputs.authorized == 'true'
39+
uses: smartcontractkit/cre-docs/.github/workflows/vault-audit-override-check.yml@main
40+
permissions:
41+
statuses: write
42+
pull-requests: read
43+
with:
44+
pr_number: ${{ github.event.pull_request.number }}
45+
head_sha: ${{ github.event.pull_request.head.sha }}
46+
chainlink_repo: ${{ github.repository }}
47+
secrets:
48+
CHAINLINK_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)