-
Notifications
You must be signed in to change notification settings - Fork 32
48 lines (40 loc) · 1.33 KB
/
update-token-list.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Update Token List on PR Merge
on:
pull_request:
types: [closed]
jobs:
update-token-list:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
environment: main
steps:
- name: Create GitHub App token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.UPDATE_LIST_APPID }}
private-key: ${{ secrets.UPDATE_LIST_SECRET }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Update token-list.json
run: python .github/scripts/update-token-list.py
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add chains/**/token-list.json
if git diff-index --quiet HEAD; then
echo "No changes to commit"
else
git commit -m 'Update token-list.json files'
git push origin HEAD:${{ github.ref }}
fi