Skip to content

Nightly Dashboard Update #87

Nightly Dashboard Update

Nightly Dashboard Update #87

name: Nightly Dashboard Update
permissions:
contents: write
pull-requests: write
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
jobs:
update-dashboard:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install python-frontmatter
- name: Generate dashboard.md
run: |
python scripts/json2table.py \
all_metadata.json \
docs/_pages/dashboard.md
- name: Commit changes if any
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/_pages/dashboard.md
if ! git diff --cached --quiet; then
git commit -m "chore: nightly update of dashboard.md"
else
echo "No changes to commit"
exit 0
fi
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v7
with:
branch: update-dashboard-md
title: "Nightly Update: dashboard.md"
body: "Automated PR to update dashboard.md from latest metadata"
delete-branch: false
auto_merge:
needs: update-dashboard
runs-on: ubuntu-latest
if: needs.update-dashboard.outputs.pull-request-number != ''
steps:
- name: Enable Auto-Merge
uses: peter-evans/enable-pull-request-automerge@v3
with:
pull-request-number: ${{ needs.update-dashboard.outputs.pull-request-number }}
merge-method: merge