Skip to content

Commit

Permalink
CI: fix auto-merge workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
boozook committed Apr 3, 2024
1 parent bab79a8 commit 77cb234
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Auto-merge
on:
pull_request:
types: ready_for_review
pull_request_target:
types: ready_for_review

Expand All @@ -17,9 +15,17 @@ jobs:
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- name: count requested reviewers
id: counter
run: |
REVIEWERS_NUM=$(echo $REQUESTED_REVIEWERS | jq '. | length')
echo "value=$REVIEWERS_NUM" >> "$GITHUB_OUTPUT"
env:
REQUESTED_REVIEWERS: ${{ toJson(github.event.pull_request.requested_reviewers) }}

- name: Approve
# if there is no requested reviewers specified:
if: !github.event.pull_request.requested_reviewers
if: steps.counter.outputs.value == '0'
run: gh pr review --approve "${{github.event.pull_request.html_url}}"

- name: Auto-merge
Expand Down

0 comments on commit 77cb234

Please sign in to comment.