|
4 | 4 | name: Stats file weekly update |
5 | 5 |
|
6 | 6 | on: |
7 | | - # Manual run enable |
8 | 7 | workflow_dispatch: |
9 | | - |
10 | | - # Automatic run enable |
11 | 8 | schedule: |
12 | 9 | - cron: '00 1 * * 1' # At 01:00 on Mondays. |
13 | | - |
14 | | - |
15 | | - |
16 | 10 |
|
17 | 11 | jobs: |
18 | | - # This workflow contains a single job |
19 | 12 | update_stats: |
20 | 13 | if: github.repository == 'ArmDeveloperEcosystem/arm-learning-paths' |
21 | 14 | runs-on: ubuntu-latest |
22 | 15 | steps: |
23 | 16 | - name: Check out current repo |
24 | | - uses: actions/checkout@v3 |
| 17 | + uses: actions/checkout@v4 |
25 | 18 | with: |
26 | | - fetch-depth: 0 |
27 | | - |
28 | | - # Use for debugging ssh sessions if needed |
29 | | - #- name: Setup tmate session |
30 | | - # uses: mxschmitt/action-tmate@v3 |
31 | | - |
32 | | - |
33 | | - # Test GitHub API if needed |
34 | | - #- name: Test GitHUB API |
35 | | - # run: | |
36 | | - # curl -L \ |
37 | | - # -H "Accept: application/vnd.github+json" \ |
38 | | - # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\ |
39 | | - # -H "X-GitHub-Api-Version: 2022-11-28" \ |
40 | | - # https://api.github.com/repos/ArmDeveloperEcosystem/arm-learning-paths/issues |
41 | | - |
42 | | - |
43 | | - # Run python script to update files |
44 | | - - name: Run Python script to update files |
45 | | - run: | |
46 | | - cd tools/ |
47 | | - pip install -r requirements.txt |
48 | | - python3 stats_data_generate.py --token ${{ secrets.GITHUB_TOKEN }} --repo https://api.github.com/repos/ArmDeveloperEcosystem/arm-learning-paths/ |
49 | | - |
50 | | - # GitHub credential setup |
51 | | - - name: setup git config |
52 | | - run: | |
53 | | - # setup the username and email. |
54 | | - git config user.name "GitHub Actions Stats Bot" |
55 | | - git config user.email "<>" |
56 | | - |
57 | | - # Commit updated files in a new PR |
58 | | - - name: Commit updated stats files to repository |
| 19 | + fetch-depth: 1 |
| 20 | + |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: '3.11' |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: pip install pyyaml requests |
| 28 | + |
| 29 | + - name: Run stats generation script |
| 30 | + run: python3 tools/stats_data_generate.py --token ${{ secrets.GITHUB_TOKEN }} |
| 31 | + |
| 32 | + - name: Fetch content_over_time.png from roadmap repo |
59 | 33 | run: | |
60 | | - git add data/stats_weekly_data.yml |
61 | | - # Push and commit only if changes to commit; if not, say so and end. |
62 | | - git commit -m 'automatic update of stats files' && git push origin main || echo "No changes to commit" |
| 34 | + curl -sL -o content/stats/content_over_time.png \ |
| 35 | + "https://raw.githubusercontent.com/ArmDeveloperEcosystem/roadmap/main/reports/content-count/content_over_time.png" |
63 | 36 |
|
| 37 | + - name: Setup git config |
| 38 | + run: | |
| 39 | + git config user.name "GitHub Actions Stats Bot" |
| 40 | + git config user.email "<>" |
64 | 41 |
|
| 42 | + - name: Commit updated stats files |
| 43 | + run: | |
| 44 | + git add data/stats_weekly_data.yml content/stats/content_over_time.png |
| 45 | + git commit -m 'automatic update of stats files' && git push origin main || echo "No changes to commit" |
0 commit comments