File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,20 +30,12 @@ jobs:
3030 DISCORD_TOKEN : ${{ secrets.DISCORD_TOKEN }}
3131 DISCORD_CHANNEL_ID : " 551846012310782014"
3232 GITHUB_REPOSITORY : ${{ github.repository }}
33- LAST_MESSAGE_ID : ${{ vars.LAST_MESSAGE_ID }}
3433 run : python scripts/discord_sync.py
3534
36- - name : Save last processed message ID
37- if : env.NEW_LAST_MESSAGE_ID != ''
38- env :
39- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
40- run : |
41- gh variable set LAST_MESSAGE_ID --body "$NEW_LAST_MESSAGE_ID"
42-
4335 - name : Commit new plugins and updated manifest
4436 run : |
4537 git config user.name "github-actions[bot]"
4638 git config user.email "github-actions[bot]@users.noreply.github.com"
47- git add plugins/ plugins.json
39+ git add plugins/ plugins.json .last_message_id
4840 git diff --cached --quiet || git commit -m "chore: add plugins from Discord [skip ci]"
4941 git push
Original file line number Diff line number Diff line change @@ -92,10 +92,8 @@ def author_from_message(msg: dict) -> str:
9292def main () -> None :
9393 channel_id = os .environ ["DISCORD_CHANNEL_ID" ]
9494 repo = os .environ .get ("GITHUB_REPOSITORY" , "unknown/plugin-store" )
95- last_msg_id = os .environ .get ("LAST_MESSAGE_ID" , "" ).strip () or None
96-
97- if last_msg_id == "0" :
98- last_msg_id = None
95+ cursor_file = Path (".last_message_id" )
96+ last_msg_id = cursor_file .read_text ().strip () if cursor_file .exists () else None
9997
10098 PLUGINS_DIR .mkdir (exist_ok = True )
10199
@@ -187,12 +185,8 @@ def main() -> None:
187185 else :
188186 print ("✅ No new .iy plugins found in new messages." )
189187
190- # Tell the workflow the new cursor value via an env file
191188 if new_last_id and new_last_id != last_msg_id :
192- env_file = os .environ .get ("GITHUB_ENV" , "" )
193- if env_file :
194- with open (env_file , "a" ) as f :
195- f .write (f"NEW_LAST_MESSAGE_ID={ new_last_id } \n " )
189+ Path (".last_message_id" ).write_text (new_last_id )
196190 print (f"📌 Cursor advanced to message { new_last_id } " )
197191
198192
You can’t perform that action at this time.
0 commit comments