Skip to content

Discord Channel Sync #2

Discord Channel Sync

Discord Channel Sync #2

name: Discord Channel Sync
on:
schedule:
# Weekly on Monday at 06:00 UTC
- cron: "0 6 * * 1"
workflow_dispatch:
permissions:
contents: write
jobs:
sync-channels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -r scripts/discord/requirements.txt
- name: Sync channel inventory
env:
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
DISCORD_GUILD_ID: ${{ secrets.DISCORD_GUILD_ID }}
run: python scripts/discord/sync_channels.py
- name: Check for changes
id: diff
run: |
git diff --quiet discord_data/channels.json && echo "changed=false" >> $GITHUB_OUTPUT || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit updated channel inventory
if: steps.diff.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add discord_data/channels.json
git commit -m "chore: sync Discord channel inventory"
git push