Skip to content

Commit c16eede

Browse files
committed
Update dependency workflow to use GitHub App token
Replaces manual commit and push steps with the use of actions/create-github-app-token and updates create-pull-request to v7. The workflow now creates pull requests using a GitHub App token, enables automatic branch deletion, and sets PRs as drafts by default.
1 parent 2d91e78 commit c16eede

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

.github/workflows/update-dependencies.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,20 @@ jobs:
6262
echo name=`gh api users/${{ github.actor }} | jq -j .name` >> $GITHUB_OUTPUT
6363
- name: Prettify
6464
run: npm run prettier-fix
65-
- name: Commit changes
66-
env:
67-
GIT_AUTHOR_NAME: ${{steps.get_author.outputs.name || github.actor}}
68-
GIT_AUTHOR_EMAIL: ${{github.actor_id}}+${{github.actor}}@users.noreply.github.com
69-
GIT_COMMITTER_NAME: github-actions[bot]
70-
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
71-
run: git commit -a -m "Update dependencies"
72-
- name: Push changes
73-
run: git push origin HEAD:update-dependencies-auto-${{ github.run_id }}
65+
- uses: actions/create-github-app-token@v1
66+
id: generate-token
67+
with:
68+
app-id: ${{ secrets.APP_ID }}
69+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
7470
- name: Create pull request
75-
uses: peter-evans/create-pull-request@v5
71+
uses: peter-evans/create-pull-request@v7
7672
with:
77-
token: ${{ github.token }}
78-
commit-message: Update dependencies
73+
token: ${{ steps.generate-token.outputs.token }}
7974
branch: update-dependencies-auto-${{ github.run_id }}
75+
delete-branch: true
76+
commit-message: Update dependencies
8077
title: Update dependencies
8178
body: |
8279
This is an automated pull request to update dependencies triggered
8380
by @${{ github.actor }} in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
84-
85-
Please mark PR as ready for review in order to kick off CI.
86-
draft: true
81+
draft: always-true

0 commit comments

Comments
 (0)