Skip to content

Stats file weekly update #72

Stats file weekly update

Stats file weekly update #72

# 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"