Skip to content

Commit d677bdf

Browse files
committed
Data updates as 2 jobs.
Isolates long-running activity updates as a separate job that can fail (and re-run) independently.
1 parent 32e56bb commit d677bdf

4 files changed

Lines changed: 104 additions & 8 deletions

File tree

.github/workflows/cache.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ on:
77

88
concurrency:
99
group: data-cache
10+
cancel-in-progress: false
1011

1112
defaults:
1213
run:
1314
shell: bash
1415

15-
env:
16-
TAG: CACHE
17-
1816
jobs:
19-
runDataUpdate:
17+
runDataCache:
2018
if: github.ref == 'refs/heads/main'
2119
name: Run Cache Request
2220
runs-on: ubuntu-latest
2321
env:
2422
REPO_DIR: main
23+
TAG: CACHE
2524
TIMESTAMP: X
2625
steps:
2726
- name: Store timestamp

.github/workflows/update.yml

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ defaults:
1616
jobs:
1717
runDataUpdate:
1818
if: github.ref == 'refs/heads/main'
19-
name: Run Data Update
19+
name: Run Main Data Update
2020
runs-on: ubuntu-latest
2121
env:
2222
REPO_DIR: main
@@ -109,7 +109,7 @@ jobs:
109109
git pull --ff-only
110110
git stash pop
111111
git add -A .
112-
git commit -m "$TIMESTAMP Data Update by ${{ steps.app-token.outputs.app-slug }}"
112+
git commit -m "$TIMESTAMP Main Data Update by ${{ steps.app-token.outputs.app-slug }}"
113113
git push
114114
115115
- name: Show health stats
@@ -126,9 +126,105 @@ jobs:
126126
if: ${{ always() }}
127127
uses: actions/upload-artifact@v7
128128
with:
129-
name: logfiles_${{ env.TIMESTAMP }}_update
129+
name: logfiles_${{ env.TIMESTAMP }}_main_update
130130
path: |
131131
${{ env.REPO_DIR }}/_visualize/LAST_MEMBERS_UPDATE.txt
132132
${{ env.REPO_DIR }}/_visualize/LAST_MEMBERS_UPDATE.log
133133
${{ env.REPO_DIR }}/_visualize/LAST_CORE_UPDATE.txt
134134
${{ env.REPO_DIR }}/_visualize/LAST_CORE_UPDATE.log
135+
136+
runDataUpdateSlow:
137+
needs: runDataUpdate
138+
name: Run Activity Data Update (SLOW)
139+
runs-on: ubuntu-latest
140+
env:
141+
REPO_DIR: main
142+
TIMESTAMP: X
143+
steps:
144+
- name: Store timestamp
145+
run: |
146+
echo "TIMESTAMP=$(date -u +"%F-%H")" >> "$GITHUB_ENV"
147+
148+
- name: Checkout
149+
uses: actions/checkout@v6
150+
with:
151+
path: ${{ env.REPO_DIR }}
152+
token: ${{ secrets.GITHUB_TOKEN }}
153+
persist-credentials: false
154+
155+
- name: Setup python
156+
uses: actions/setup-python@v6
157+
with:
158+
python-version: '3.11'
159+
cache: 'pip'
160+
cache-dependency-path: '${{ env.REPO_DIR }}/_visualize/scripts/requirements.txt'
161+
162+
- name: Install dependencies
163+
run: pip install -r $REPO_DIR/_visualize/scripts/requirements.txt
164+
165+
- name: Run data collection script with Action Token
166+
run: |
167+
set -eu
168+
cd $REPO_DIR/_visualize/scripts
169+
./UPDATE.sh $TAG
170+
env:
171+
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172+
TAG: SLOW
173+
174+
- name: Validate slow data updates
175+
run: ./$REPO_DIR/.github/scripts/validate.sh
176+
env:
177+
TAG: SLOW
178+
179+
- name: Create GitHub App Installation Token
180+
uses: actions/create-github-app-token@v3
181+
id: app-token
182+
with:
183+
client-id: ${{ vars.CLIENT_ID }}
184+
private-key: ${{ secrets.PRIVATE_KEY }}
185+
186+
- name: Get GitHub App User ID
187+
id: get-user-id
188+
env:
189+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
190+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
191+
192+
- name: Configure git
193+
env:
194+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
195+
run: |
196+
gh auth setup-git
197+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
198+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
199+
200+
- name: Commit updated data
201+
env:
202+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
203+
run: |
204+
set -eu
205+
cd $REPO_DIR
206+
git stash
207+
git pull --ff-only
208+
git stash pop
209+
git add -A .
210+
git commit -m "$TIMESTAMP Activity Data Update by ${{ steps.app-token.outputs.app-slug }}"
211+
git push
212+
213+
- name: Show health stats
214+
if: ${{ always() }}
215+
run: |
216+
for TAG in SLOW; do
217+
cat $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.txt || true
218+
echo "Warning Count: $(grep -c 'Warning' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
219+
echo "From Timeouts: $(grep -c 'but failed' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
220+
echo "Limit Reached: $(grep -c 'rate limit exceeded' $REPO_DIR/_visualize/LAST_${TAG}_UPDATE.log)"
221+
done
222+
223+
- name: Save log files
224+
if: ${{ always() }}
225+
uses: actions/upload-artifact@v7
226+
with:
227+
name: logfiles_${{ env.TIMESTAMP }}_activity_update
228+
path: |
229+
${{ env.REPO_DIR }}/_visualize/LAST_SLOW_UPDATE.txt
230+
${{ env.REPO_DIR }}/_visualize/LAST_SLOW_UPDATE.log

_visualize/scripts/UPDATE_CORE.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ get_repos_users
77
# --- ADDITIONAL REPO DETAILS ---
88
get_repos_languages
99
get_repos_topics
10-
get_repos_activitycommits
1110
get_repos_dependencies
1211
get_dependency_info
1312
# --- HISTORY FOR ALL TIME ---

_visualize/scripts/UPDATE_SLOW.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# --- REPO COMMIT ACTIVITY (SLOW) ---
2+
get_repos_activitycommits

0 commit comments

Comments
 (0)