Record Traffic Insights #30
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: Record Traffic Insights | |
on: | |
schedule: | |
- cron: '0 0 1,14 * *' # Runs every 1st and 16th days of the month at midnight UTC | |
workflow_dispatch: # Allows manual triggering | |
permissions: | |
contents: write | |
jobs: | |
log-traffic-insights: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' # Specify the Python version you need | |
- name: Install dependencies | |
run: | | |
pip install requests beautifulsoup4 pdfkit Jinja2==3.1.5 MarkupSafe==3.0.2 | |
sudo apt-get install -y wkhtmltopdf # Install wkhtmltopdf | |
- name: Run traffic insights script | |
env: | |
ACCESS_TOKEN: ${{ secrets.KEY }} # Use GitHub token or set your own secret | |
OWNER: ${{ secrets.USERNAME }} # Replace with your GitHub username | |
REPO: ${{ secrets.REPO }} # Replace with your repository name | |
run: | | |
python CODE/SCRIPTS/traffic_logging.py | |
- name: run python script to update mermaid markdown | |
run: python CODE/SCRIPTS/chart_gen.py | |
- name: Commit changes to CSV | |
run: | | |
git config --local user.name "github-actions" | |
git config --local user.email "[email protected]" | |
git add . | |
git commit -m "Update traffic log with new insights" || echo "No changes to commit" | |
git push |