Repo Traffic - Data & figures #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Repo Traffic - Data & figures | |
on: | |
schedule: | |
- cron: '0 0 1,11,21 * *' # Runs 1st, 11th, and 21st of every month | |
workflow_dispatch: | |
jobs: | |
update-data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
pip install requests pandas matplotlib seaborn | |
- name: Run script | |
env: | |
OWNER: 'demidenm' # GitHub repo owner | |
REPO: 'PyReliMRI' # GitHub repo name | |
MY_ACCESS_TOKEN: ${{ secrets.REPO_A_ACCESS_TOKEN }} # Settings -> Secrets and variables -> Actions -> New Repository secret | |
run: | | |
python git_traffik/repo_check-traffic.py | |
- name: List files in output directory | |
run: | | |
ls -alh git_traffik/output/ | |
- name: Upload output files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: output-files | |
path: git_traffik/output/* | |
- name: Config Git | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "[email protected]" | |
- name: Check git status | |
run: | | |
git status | |
- name: Add files | |
run: | | |
git add git_traffik/output/* | |
git status | |
- name: Commit files | |
run: | | |
git commit -m "Add generated files to output directory" || echo "No changes to commit" | |
continue-on-error: true | |
- name: Force push changes # This way files are always updated if their hashes differ | |
run: | | |
git push origin main --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_A_ACCESS_TOKEN }} |