Skip to content

Commit 1864e10

Browse files
committed
see if direct api usage works
1 parent 1329dbe commit 1864e10

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/cleanup.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: |
4141
user="${{ github.actor }}"
4242
repo="${{ github.repository }}"
43-
status=$(curl -s -o /dev/null -w '%{http_code}' \
43+
status=$(curl -L -s -o /dev/null -w '%{http_code}' \
4444
-H "Authorization: Bearer $GITHUB_TOKEN" \
4545
-H "Accept: application/vnd.github+json" \
4646
"https://api.github.com/repos/$repo/collaborators/$user")
@@ -53,7 +53,9 @@ jobs:
5353
env:
5454
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5555

56+
5657
- name: Create Pull Request if necessary
58+
id: create-pr
5759
uses: peter-evans/create-pull-request@v7
5860
with:
5961
branch: auto-cleanup
@@ -63,4 +65,18 @@ jobs:
6365
delete-branch: true
6466
token: ${{ secrets.AUTO_PR_TOKEN }}
6567
push-to-fork: ${{ vars.AUTO_PR_FORK_NAME != '' && vars.AUTO_PR_FORK_NAME || secrets.AUTO_PR_FORK_NAME }}
66-
reviewers: ${{ steps.check-collaborator.outputs.reviewer }}
68+
# reviewers: ${{ steps.check-collaborator.outputs.reviewer }}
69+
70+
- name: set reviewer
71+
if: ${{ steps.check-collaborator.outputs.reviewer != '' }}
72+
run: |
73+
user="${{ github.actor }}"
74+
repo="${{ github.repository }}"
75+
curl -L \
76+
-X POST \
77+
-H "Authorization: Bearer $GITHUB_TOKEN" \
78+
-H "Accept: application/vnd.github+json" \
79+
-H "X-GitHub-Api-Version: 2022-11-28" \
80+
https://api.github.com/repos/$repo/pulls/${{steps.create-pr.outputs.pull-request-number}}/requested_reviewers \
81+
-d '{"reviewers":["${{ steps.check-collaborator.outputs.reviewer }}"]}'
82+

0 commit comments

Comments
 (0)