-
Notifications
You must be signed in to change notification settings - Fork 156
63 lines (47 loc) · 2.04 KB
/
weekly_stats_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
# Result: updated files content/stats/stats_weekly_data.yml content/stats/stats_current_test_info.yml
# Will appear in learn.arm.com/stats
name: Stats file weekly update
on:
# Manual run enable
workflow_dispatch:
# Automatic run enable
schedule:
- cron: '00 1 * * 1' # At 01:00 on Mondays.
jobs:
# This workflow contains a single job
update_stats:
runs-on: ubuntu-latest
steps:
- name: Check out current repo
uses: actions/checkout@v3
with:
fetch-depth: 0
# Use for debugging ssh sessions if needed
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# Test GitHub API if needed
#- name: Test GitHUB API
# run: |
# curl -L \
# -H "Accept: application/vnd.github+json" \
# -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
# -H "X-GitHub-Api-Version: 2022-11-28" \
# https://api.github.com/repos/ArmDeveloperEcosystem/arm-learning-paths/issues
# Run python script to update files
- name: Run Python script to update files
run: |
cd tools/
pip install -r requirements.txt
python3 stats_data_generate.py --token ${{ secrets.GITHUB_TOKEN }} --repo https://api.github.com/repos/ArmDeveloperEcosystem/arm-learning-paths/
# GitHub credential setup
- name: setup git config
run: |
# setup the username and email.
git config user.name "GitHub Actions Stats Bot"
git config user.email "<>"
# Commit updated files in a new PR
- name: Commit updated stats files to repository
run: |
git add data/stats_weekly_data.yml data/stats_current_test_info.yml
# Push and commit only if changes to commit; if not, say so and end.
git commit -m 'automatic update of stats files' && git push origin main || echo "No changes to commit"