Skip to content

Commit 1400cfd

Browse files
committed
add Discord auto-sync workflow for .iy plugins
1 parent a49b2ad commit 1400cfd

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
actions: write
1011

1112
jobs:
1213
sync:
@@ -29,8 +30,6 @@ jobs:
2930
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
3031
DISCORD_CHANNEL_ID: "551846012310782014"
3132
GITHUB_REPOSITORY: ${{ github.repository }}
32-
CUTOFF_DATE: "2026-05-29"
33-
# Persisted across runs so we only fetch messages we haven't seen
3433
LAST_MESSAGE_ID: ${{ vars.LAST_MESSAGE_ID }}
3534
run: python scripts/discord_sync.py
3635

@@ -47,4 +46,4 @@ jobs:
4746
git config user.email "github-actions[bot]@users.noreply.github.com"
4847
git add plugins/ plugins.json
4948
git diff --cached --quiet || git commit -m "chore: add plugins from Discord [skip ci]"
50-
git push
49+
git push

scripts/discord_sync.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
import re
34
import sys
45
import time
56
from datetime import date, datetime, timezone, timedelta
@@ -93,6 +94,9 @@ def main() -> None:
9394
repo = os.environ.get("GITHUB_REPOSITORY", "unknown/plugin-store")
9495
last_msg_id = os.environ.get("LAST_MESSAGE_ID", "").strip() or None
9596

97+
if last_msg_id == "0":
98+
last_msg_id = None
99+
96100
PLUGINS_DIR.mkdir(exist_ok=True)
97101

98102
print(f"🔍 Fetching messages from channel {channel_id}"
@@ -152,7 +156,6 @@ def main() -> None:
152156
description = ""
153157
try:
154158
text = dest.read_text(encoding="utf-8", errors="replace")
155-
import re
156159
for line in text.splitlines()[:30]:
157160
stripped = line.strip().lstrip("-").lstrip("#").strip()
158161
m = re.match(r"@desc(?:ription)?\s+(.+)", stripped, re.IGNORECASE)

0 commit comments

Comments
 (0)