Skip to content

TrafficPlot Auto Generation #11

TrafficPlot Auto Generation

TrafficPlot Auto Generation #11

name: TrafficPlot Auto Generation
on:
schedule:
- cron: '0 0 1,8,16,24 * *' # Runs on the 1st, 8th, 16th and 24th of every month at 00:00 UTC
workflow_dispatch: # Allow manual triggering of workflows
jobs:
generate_image:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check if the repo is the original one
run: |
if [[ "${{ github.repository }}" != "arc-research-lab/Aries" ]]; then
echo "Not the original repo, skipping workflow."
exit 0
fi
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.12'
- name: Install PyGithub version 2.6.1
run: pip install PyGithub==2.6.1
- name: Install dependencies
run: |
pip3 install pandas matplotlib PyGithub pillow seaborn
- name: Run image generation script
run: python3 utils/GithubTrafficPlot.py token:${{ secrets.GH_PAT }} utils/repo.txt assets/ #
- name: Commit and push generated image
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -f ./assets/*_traffic_plot.png ./assets/*.csv
git commit -m "Auto-generated traffic_plot.png and plot_data.csv" || echo "No changes to commit"
git pull --rebase
git push https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}.git