Skip to content

Update tags, categories and pagelist #29

Update tags, categories and pagelist

Update tags, categories and pagelist #29

Workflow file for this run

name: Update tags, categories and pagelist
on:
schedule:
- cron: '0 2 * * *' # Every night at 02:00 UTC
workflow_dispatch: # Allows manual triggering
jobs:
update-tags-categories-and-pagelist:
runs-on: ubuntu-latest
permissions:
contents: write # Required to push changes back
steps:
# Step 1: Check out the repository
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # Fetch all history for proper commits
# Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
# Step 3: Install the required Python packages
- name: Install Python packages
run: |
python -m pip install --upgrade pip
pip install python-frontmatter pyyaml
# Step 4: Update the tags, categories and pagelist
- name: Process repository
run: |
python _scripts/update-tags.py
python _scripts/update-categories.py
python _scripts/update-pagelist.py
# Step 5: Configure Git
- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Step 6: Commit changes
- name: Commit changes
run: |
git add .
git diff --quiet && git diff --staged --quiet || git commit -m "Automated changes by GitHub Action"
# Step 7: Push changes back
- name: Push changes
run: |
git push origin HEAD:${GITHUB_REF#refs/heads/}