Skip to content

Commit ff79117

Browse files
committed
chore: adjust license update
1 parent 667ad6d commit ff79117

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

.github/workflows/update-license.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,42 @@ jobs:
3333
- name: Update LICENSE
3434
run: |
3535
sed -i -E "s/$REGEX/\1${{steps.info.outputs.license-year}}\2/" LICENSE
36+
- name: Generate app token
37+
id: app-token
38+
uses: actions/[email protected]
39+
with:
40+
app-id: ${{secrets.GH_APP_ID}}
41+
private-key: ${{secrets.GH_APP_PRIVATE_KEY}}
42+
- name: Generate user info
43+
id: user-info
44+
run: |
45+
USER_NAME="$GH_APP_SLUG[bot]"
46+
USER_ID=$(gh api "/users/$USER_NAME" --jq .id)
47+
USER_EMAIL="[email protected]"
48+
echo "id=$USER_ID" >> $GITHUB_OUTPUT
49+
echo "name=$USER_NAME" >> $GITHUB_OUTPUT
50+
echo "[email protected]" >> $GITHUB_OUTPUT
51+
echo "commit-author=$USER_NAME <$USER_EMAIL>" >> $GITHUB_OUTPUT
52+
env:
53+
GH_APP_SLUG: ${{steps.app-token.outputs.app-slug}}
54+
GH_TOKEN: ${{steps.app-token.outputs.token}}
3655
- name: Handle changes
3756
uses: peter-evans/[email protected]
3857
id: changes
3958
with:
40-
token: ${{secrets.AUTOMATION_TOKEN}}
59+
token: ${{steps.app-token.outputs.token}}
4160
commit-message: ${{steps.info.outputs.update-title}}
42-
committer: ${{env.GIT_USER}}
61+
author: ${{steps.user-info.outputs.commit-author}}
62+
committer: ${{steps.user-info.outputs.commit-author}}
4363
add-paths: LICENSE
44-
author: ${{env.GIT_USER}}
4564
branch: auto/update-license
4665
delete-branch: true
4766
title: ${{steps.info.outputs.update-title}}
4867
body: ${{steps.info.outputs.update-body}}
4968
labels: auto
50-
env:
51-
GIT_USER: ${{secrets.AUTOMATION_USER}} <${{secrets.AUTOMATION_EMAIL}}>
5269
- name: Enable auto-merge
5370
if: steps.changes.outputs.pull-request-operation == 'created'
5471
run: gh pr merge --auto --rebase "$PULL_REQUEST_URL"
5572
env:
5673
PULL_REQUEST_URL: ${{steps.changes.outputs.pull-request-url}}
57-
GITHUB_TOKEN: ${{secrets.AUTOMATION_TOKEN}}
74+
GITHUB_TOKEN: ${{steps.app-token.outputs.token}}

.github/workflows/update-node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
echo "update-body=$UPDATE_BODY" >> $GITHUB_OUTPUT
3232
- name: Update .nvmrc
3333
run: echo '${{steps.info.outputs.version}}' > .nvmrc
34-
- name: GEnerate app token
34+
- name: Generate app token
3535
id: app-token
3636
uses: actions/[email protected]
3737
with:

0 commit comments

Comments
 (0)