Skip to content

Commit dde9ec8

Browse files
committed
Fix PR workflow
1 parent 94e2cad commit dde9ec8

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Approval Check Worker
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
run-when-command:
9+
if: >
10+
github.event.issue.pull_request != null &&
11+
(contains(github.event.comment.body, '/review') || contains(github.event.comment.body, 'review'))
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
issues: write
17+
statuses: write
18+
19+
outputs:
20+
number: ${{ steps.pr.outputs.number }}
21+
sha: ${{ steps.pr.outputs.sha }}
22+
23+
steps:
24+
- name: Get latest PR head SHA
25+
id: pr
26+
uses: actions/github-script@v7
27+
with:
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
script: |
30+
const prNumber = context.payload.issue.number;
31+
const { data: pr } = await github.rest.pulls.get({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
pull_number: prNumber,
35+
});
36+
core.setOutput('number', String(prNumber));
37+
core.setOutput('sha', pr.head.sha);
38+
39+
check-approvals:
40+
needs: run-when-command
41+
if: ${{ always() && needs.run-when-command.result == 'success' }}
42+
permissions:
43+
contents: write
44+
pull-requests: write
45+
statuses: write
46+
issues: write
47+
uses: tetherto/qvac-devops/.github/workflows/approval-check-worker.yml@temp-pr-workflow-new
48+
secrets: inherit
49+
with:
50+
pr_number: ${{ fromJSON(needs.run-when-command.outputs.number) }}
51+
pr_sha: ${{ needs.run-when-command.outputs.sha }}

0 commit comments

Comments
 (0)