forked from llnl/llnl.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
230 lines (200 loc) · 7.3 KB
/
Copy pathupdate.yml
File metadata and controls
230 lines (200 loc) · 7.3 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Routine Data Update
on:
workflow_dispatch:
schedule:
- cron: '45 10 * * *'
concurrency:
group: data-updates
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
runDataUpdate:
if: github.ref == 'refs/heads/main'
name: Run Main Data Update
runs-on: ubuntu-latest
env:
REPO_DIR: main
TIMESTAMP: X
steps:
- name: Store timestamp
run: |
echo "TIMESTAMP=$(date -u +"%F-%H")" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v6
with:
path: ${{ env.REPO_DIR }}
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Setup python
uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: '${{ env.REPO_DIR }}/_visualize/scripts/requirements.txt'
- name: Install dependencies
run: pip install -r $REPO_DIR/_visualize/scripts/requirements.txt
- name: Create GitHub App Installation Token1
uses: actions/create-github-app-token@v3
id: app-token1
with:
client-id: ${{ vars.CLIENT_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Run data collection script with App Installation Token
run: |
set -eu
cd $REPO_DIR/_visualize/scripts
./UPDATE.sh $TAG
env:
GITHUB_API_TOKEN: ${{ steps.app-token1.outputs.token }}
TAG: MEMBERS
- name: Validate members data updates
run: ./$REPO_DIR/.github/scripts/validate.sh
env:
TAG: MEMBERS
- name: Run data collection script with Action Token
run: |
set -eu
cd $REPO_DIR/_visualize/scripts
./UPDATE.sh $TAG
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: CORE
- name: Validate core data updates
run: ./$REPO_DIR/.github/scripts/validate.sh
env:
TAG: CORE
- name: Create GitHub App Installation Token
uses: actions/create-github-app-token@v3
id: app-token
with:
client-id: ${{ vars.CLIENT_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Get GitHub App User ID
id: get-user-id
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- name: Configure git
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh auth setup-git
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
- name: Commit updated data
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
set -eu
cd $REPO_DIR
git stash
git pull --ff-only
git stash pop
git add -A .
git commit -m "$TIMESTAMP Main Data Update by ${{ steps.app-token.outputs.app-slug }}"
git push
- name: Show health stats
if: ${{ always() }}
run: |
for TAG in MEMBERS CORE; do
cat $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.txt || true
echo "Warning Count: $(grep -c 'Warning' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
echo "From Timeouts: $(grep -c 'but failed' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
echo "Limit Reached: $(grep -c 'rate limit exceeded' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
done
- name: Save log files
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: logfiles_${{ env.TIMESTAMP }}_main_update
path: |
${{ env.REPO_DIR }}/_visualize/LAST_MEMBERS_UPDATE.txt
${{ env.REPO_DIR }}/_visualize/LAST_MEMBERS_UPDATE.log
${{ env.REPO_DIR }}/_visualize/LAST_CORE_UPDATE.txt
${{ env.REPO_DIR }}/_visualize/LAST_CORE_UPDATE.log
runDataUpdateSlow:
needs: runDataUpdate
name: Run Activity Data Update (SLOW)
runs-on: ubuntu-latest
env:
REPO_DIR: main
TIMESTAMP: X
steps:
- name: Store timestamp
run: |
echo "TIMESTAMP=$(date -u +"%F-%H")" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v6
with:
path: ${{ env.REPO_DIR }}
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Setup python
uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: '${{ env.REPO_DIR }}/_visualize/scripts/requirements.txt'
- name: Install dependencies
run: pip install -r $REPO_DIR/_visualize/scripts/requirements.txt
- name: Run data collection script with Action Token
run: |
set -eu
cd $REPO_DIR/_visualize/scripts
./UPDATE.sh $TAG
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: SLOW
- name: Validate slow data updates
run: ./$REPO_DIR/.github/scripts/validate.sh
env:
TAG: SLOW
- name: Create GitHub App Installation Token
uses: actions/create-github-app-token@v3
id: app-token
with:
client-id: ${{ vars.CLIENT_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Get GitHub App User ID
id: get-user-id
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- name: Configure git
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh auth setup-git
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
- name: Commit updated data
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
set -eu
cd $REPO_DIR
git stash
git pull --ff-only
git stash pop
git add -A .
git commit -m "$TIMESTAMP Activity Data Update by ${{ steps.app-token.outputs.app-slug }}"
git push
- name: Show health stats
if: ${{ always() }}
run: |
for TAG in SLOW; do
cat $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.txt || true
echo "Warning Count: $(grep -c 'Warning' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
echo "From Timeouts: $(grep -c 'but failed' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
echo "Limit Reached: $(grep -c 'rate limit exceeded' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
done
- name: Save log files
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: logfiles_${{ env.TIMESTAMP }}_activity_update
path: |
${{ env.REPO_DIR }}/_visualize/LAST_SLOW_UPDATE.txt
${{ env.REPO_DIR }}/_visualize/LAST_SLOW_UPDATE.log