Skip to content

Commit ebfb5b0

Browse files
committed
ci: use PR-based sync for Discord channels
- Replace direct commit-and-push with peter-evans/create-pull-request to open an automated PR (branch: automation/discord-channel-sync) updating discord_data/channels.json. - Add pull-requests: write permission and a concurrency group (discord-channel-sync) so runs are coordinated and not canceled. - The workflow now creates a descriptive PR against the repository default branch instead of pushing changes directly.
1 parent 1e2b1ba commit ebfb5b0

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

.github/workflows/discord-channel-sync.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88

99
permissions:
1010
contents: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: discord-channel-sync
15+
cancel-in-progress: false
1116

1217
jobs:
1318
sync-channels:
@@ -33,11 +38,18 @@ jobs:
3338
run: |
3439
git diff --quiet discord_data/channels.json && echo "changed=false" >> $GITHUB_OUTPUT || echo "changed=true" >> $GITHUB_OUTPUT
3540
36-
- name: Commit updated channel inventory
41+
- name: Create PR with updated channel inventory
3742
if: steps.diff.outputs.changed == 'true'
38-
run: |
39-
git config user.name "github-actions[bot]"
40-
git config user.email "github-actions[bot]@users.noreply.github.com"
41-
git add discord_data/channels.json
42-
git commit -m "chore: sync Discord channel inventory"
43-
git push
43+
uses: peter-evans/create-pull-request@v7
44+
with:
45+
commit-message: "chore: sync Discord channel inventory"
46+
title: "chore: sync Discord channel inventory"
47+
body: |
48+
Automated update generated by the Discord Channel Sync workflow.
49+
50+
This PR updates the Discord channel inventory file:
51+
- discord_data/channels.json
52+
branch: automation/discord-channel-sync
53+
base: ${{ github.event.repository.default_branch }}
54+
add-paths: |
55+
discord_data/channels.json

0 commit comments

Comments
 (0)