-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (78 loc) · 2.62 KB
/
update.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"on":
schedule:
- cron: 0 12 * * *
workflow_dispatch: {}
name: Update
jobs:
update:
runs-on: ubuntu-latest
outputs:
hasUpdate: ${{ steps.update.outputs.hasUpdate }}
startSeq: ${{ steps.update.outputs.startSeq }}
endSeq: ${{ steps.update.outputs.endSeq }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: npm
node-version: 18
- run: npm ci
- run: node bin/cli.js
id: update
env:
GITHUB_APP_ID: ${{ vars.ALL_CONTRIBUTORS_IMPORT_APP_ID }}
GITHUB_PRIVATE_KEY: ${{ secrets.ALL_CONTRIBUTORS_IMPORT_APP_PRIVATE_KEY }}
- if: steps.update.outputs.hasUpdate
uses: actions/upload-artifact@v3
with:
name: endorsements.csv
path: data/endorsements.csv
- if: steps.update.outputs.hasUpdate
uses: actions/upload-artifact@v3
with:
name: source-files.csv
path: data/source-files.csv
handleUpdate:
needs: update
if: ${{ needs.update.outputs.hasUpdate }}
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app_id: ${{ vars.ALL_CONTRIBUTORS_IMPORT_APP_ID }}
private_key: ${{ secrets.ALL_CONTRIBUTORS_IMPORT_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
token: ${{ steps.app-token.outputs.token }}
- uses: actions/setup-node@v3
with:
cache: npm
node-version: 18
- run: npm ci
- run: rm data/*
- uses: actions/download-artifact@v2
with:
name: endorsements.csv
path: data
- uses: actions/download-artifact@v2
with:
name: source-files.csv
path: data
# test integratity of data
- run: npm run test
# commit back to main branch
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_user_name: "all-contributors-import[bot]"
commit_user_email: "138532524+all-contributors-import[bot]@users.noreply.github.com"
commit_author: "all-contributors-import[bot] <138532524+all-contributors-import[bot]@users.noreply.github.com>"
commit_message: "data: update"
file_pattern: "data/*.csv"
# push data back to main
- run: node scripts/notify.js
env:
GITHUB_APP_ID: ${{ vars.ALL_CONTRIBUTORS_IMPORT_APP_ID }}
GITHUB_APP_PRIVATE_KEY: ${{ secrets.ALL_CONTRIBUTORS_IMPORT_APP_PRIVATE_KEY }}
START_SEQ: ${{ needs.update.outputs.startSeq }}
END_SEQ: ${{ needs.update.outputs.endSeq }}