File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,33 @@ name: "Auto Approve Workflow Runs"
22
33on : pull_request
44
5+ permissions :
6+ actions : " write"
7+
58jobs :
69 auto-approve-workflow :
710 runs-on : ubuntu-latest
811 steps :
912 - name : Checkout
1013 uses : actions/checkout@v4
1114
12- - name : " Print comments"
15+ - name : Approve workflow run
16+ env :
17+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
1318 run : |
14- echo "comments: ${{ github.event.pull_request.comments }}"
19+ set +e
20+
21+ comments=$(gh pr view --json comments)
22+
23+ # The enum values are explained here:
24+ # https://docs.github.com/en/graphql/reference/enums#commentauthorassociation
25+ expr='
26+ .comments
27+ | map(select(.authorAssociation | IN("COLLABORATOR", "MEMBER", "OWNER")))
28+ | any(.body | contains("@rerun-bot approve"))
29+ '
30+
31+ if [ $(echo "$comments" | jq "$expr") = "true" ]; then
32+ echo "can approve run_id:${{ github.run_id }}"
33+ fi
1534
You can’t perform that action at this time.
0 commit comments