Skip to content

Commit 9ff4927

Browse files
xylaraltheaden
authored andcommitted
Switch pre-commit update workflow to use two tokens
In this merge, we go back to the simplified workflow that does not use conda to install `gh` and instead use the latest `gh` from github-actions. This requires using a personal access token (PAT) to set reviewers and labels, so one has been added to the repo. We still use the github-actions bot to open the PR so it doesn't get opened as @xylar (and @xylar can still review).
1 parent 6280dd7 commit 9ff4927

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/pre_commit_update_workflow.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# The second command will fail if no changes were present, so we ignore it
4545
git commit -m "Update pre-commit dependencies" || ( echo "UP_TO_DATE=true" >> "$GITHUB_ENV")
4646
47-
- name: Push Changes
47+
- name: Push Changes with github-actions bot
4848
if: ${{ env.UP_TO_DATE == 'false' }}
4949
uses: ad-m/github-push-action@master
5050
with:
@@ -55,7 +55,7 @@ jobs:
5555
env:
5656
GH_TOKEN: ${{ github.token }}
5757

58-
- name: Make PR and add reviewers and labels
58+
- name: Create PR with github-actions bot
5959
if: ${{ env.UP_TO_DATE == 'false' }}
6060
run: |
6161
cd update-pre-commit-deps
@@ -68,3 +68,19 @@ jobs:
6868
env:
6969
GH_TOKEN: ${{ github.token }}
7070

71+
- name: Add reviewers and labels with PAT
72+
if: ${{ env.UP_TO_DATE == 'false' }}
73+
run: |
74+
cd update-pre-commit-deps
75+
76+
gh pr edit --add-label ci
77+
78+
IFS=',' read -ra reviewers <<< "${REVIEWERS}"
79+
for reviewer in "${reviewers[@]}"; do
80+
echo "Adding reviewer: $reviewer"
81+
gh pr edit --add-reviewer "$reviewer"
82+
done
83+
84+
env:
85+
REVIEWERS: ${{ env.REVIEWERS }}
86+
GH_TOKEN: ${{ secrets.GH_CLI_TOKEN }}

0 commit comments

Comments
 (0)