Skip to content

Discord Channel Sync #18

Discord Channel Sync

Discord Channel Sync #18

name: Discord Channel Sync
on:
schedule:
# Weekly on Monday at 06:00 UTC
- cron: "0 6 * * 1"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: discord-channel-sync
cancel-in-progress: false
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: Create PR with updated channel inventory
if: steps.diff.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore: sync Discord channel inventory"
title: "chore: sync Discord channel inventory"
body: |
Automated update generated by the Discord Channel Sync workflow.
This PR updates the Discord channel inventory file:
- discord_data/channels.json
branch: automation/discord-channel-sync
base: ${{ github.event.repository.default_branch }}
add-paths: |
discord_data/channels.json