From 05d16900ee3a078c78298b90bf2eae8c2c51ff02 Mon Sep 17 00:00:00 2001
From: Kelvin Tan <kelv@discourse.org>
Date: Fri, 4 Apr 2025 16:34:00 +0800
Subject: [PATCH 1/2] DEV: add github workflow for auto-update of app events
 docs

---
 .github/workflows/update-app-events-docs | 67 ++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 .github/workflows/update-app-events-docs

diff --git a/.github/workflows/update-app-events-docs b/.github/workflows/update-app-events-docs
new file mode 100644
index 0000000..56de6e4
--- /dev/null
+++ b/.github/workflows/update-app-events-docs
@@ -0,0 +1,67 @@
+name: Update App Events Documentation
+
+on:
+  schedule:
+    - cron: '0 0 * * 1' # Run every Monday at 00:00 UTC
+  workflow_dispatch:
+
+jobs:
+  update-app-events-docs:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout App Events Generator
+        uses: actions/checkout@v4
+
+      - name: Checkout Discourse Core
+        uses: actions/checkout@v4
+        with:
+          repository: discourse/discourse
+          path: 'discourse'
+
+      - name: Setup Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: 21
+
+      - name: Set up pnpm
+        uses: pnpm/action-setup@v4
+        with:
+          package_json_file: package.json
+
+      - name: Install Dependencies
+        run: pnpm install
+
+      - name: Create .env file
+        run: echo "DISCOURSE_CORE=./discourse" > .env
+
+      - name: Extract App Events
+        run: node scripts/extract_app_events.mjs
+      
+      - name: Generate App Events Documentation
+        run: node scripts/create_app_events_doc_markdown.mjs
+
+      - name: Checkout Developer Docs
+        uses: actions/checkout@v4
+        with:
+          repository: discourse/discourse-developer-docs
+          path: 'discourse-developer-docs'
+          token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Update Developer Docs
+        run: |
+          cp app_events_doc.md discourse-developer-docs/docs/03-code-internals/22-app-events-triggers.md
+
+      - name: Create Pull Request
+        uses: peter-evans/create-pull-request@v7
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+          path: 'discourse-developer-docs'
+          commit-message: Update App Events documentation
+          title: Update App Events Documentation
+          body: |
+            This PR updates the App Events documentation in the developer docs.
+            
+            The documentation was automatically generated using the discourse-app-events-docs-generator tool.
+          branch: dev-update-app-events-docs
+          delete-branch: true
+          base: main

From bafd68e3638fbe8a93045636f3ee761002f78ac3 Mon Sep 17 00:00:00 2001
From: Kelvin Tan <kelv@discourse.org>
Date: Fri, 4 Apr 2025 16:51:07 +0800
Subject: [PATCH 2/2] DEV: add workflow for auto updating app events data

---
 .github/workflows/update-app-events-data | 52 ++++++++++++++++++
 .github/workflows/update-app-events-docs | 67 ------------------------
 2 files changed, 52 insertions(+), 67 deletions(-)
 create mode 100644 .github/workflows/update-app-events-data
 delete mode 100644 .github/workflows/update-app-events-docs

diff --git a/.github/workflows/update-app-events-data b/.github/workflows/update-app-events-data
new file mode 100644
index 0000000..ff64a88
--- /dev/null
+++ b/.github/workflows/update-app-events-data
@@ -0,0 +1,52 @@
+name: Update App Events Data
+
+on:
+  schedule:
+    - cron: '0 0 * * 1' # Run every Monday at 00:00 UTC
+  workflow_dispatch:     # Allow manual triggering
+
+jobs:
+  update-app-events-data:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout App Events Generator
+        uses: actions/checkout@v4
+
+      - name: Checkout Discourse Core
+        uses: actions/checkout@v4
+        with:
+          repository: discourse/discourse
+          path: 'discourse'
+
+      - name: Setup Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: 21
+
+      - name: Set up pnpm
+        uses: pnpm/action-setup@v4
+        with:
+          package_json_file: package.json
+
+      - name: Install Dependencies
+        run: pnpm install
+
+      - name: Create .env file
+        run: echo "DISCOURSE_CORE=./discourse" > .env
+
+      - name: Extract App Events
+        run: node scripts/extract_app_events.mjs
+
+      - name: Create Pull Request
+        uses: peter-evans/create-pull-request@v7
+        with:
+          commit-message: Update app events data
+          title: Update App Events Data
+          body: |
+            This PR updates the app events data files:
+            - lib/app_events_docs_generator/app_events/app_events_details.json
+            - lib/app_events_docs_generator/app_events/event-ids.yml
+
+            The data was extracted from the latest Discourse core repository.
+          branch: dev-update-app-events-data
+          delete-branch: true
diff --git a/.github/workflows/update-app-events-docs b/.github/workflows/update-app-events-docs
deleted file mode 100644
index 56de6e4..0000000
--- a/.github/workflows/update-app-events-docs
+++ /dev/null
@@ -1,67 +0,0 @@
-name: Update App Events Documentation
-
-on:
-  schedule:
-    - cron: '0 0 * * 1' # Run every Monday at 00:00 UTC
-  workflow_dispatch:
-
-jobs:
-  update-app-events-docs:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout App Events Generator
-        uses: actions/checkout@v4
-
-      - name: Checkout Discourse Core
-        uses: actions/checkout@v4
-        with:
-          repository: discourse/discourse
-          path: 'discourse'
-
-      - name: Setup Node.js
-        uses: actions/setup-node@v4
-        with:
-          node-version: 21
-
-      - name: Set up pnpm
-        uses: pnpm/action-setup@v4
-        with:
-          package_json_file: package.json
-
-      - name: Install Dependencies
-        run: pnpm install
-
-      - name: Create .env file
-        run: echo "DISCOURSE_CORE=./discourse" > .env
-
-      - name: Extract App Events
-        run: node scripts/extract_app_events.mjs
-      
-      - name: Generate App Events Documentation
-        run: node scripts/create_app_events_doc_markdown.mjs
-
-      - name: Checkout Developer Docs
-        uses: actions/checkout@v4
-        with:
-          repository: discourse/discourse-developer-docs
-          path: 'discourse-developer-docs'
-          token: ${{ secrets.GITHUB_TOKEN }}
-
-      - name: Update Developer Docs
-        run: |
-          cp app_events_doc.md discourse-developer-docs/docs/03-code-internals/22-app-events-triggers.md
-
-      - name: Create Pull Request
-        uses: peter-evans/create-pull-request@v7
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          path: 'discourse-developer-docs'
-          commit-message: Update App Events documentation
-          title: Update App Events Documentation
-          body: |
-            This PR updates the App Events documentation in the developer docs.
-            
-            The documentation was automatically generated using the discourse-app-events-docs-generator tool.
-          branch: dev-update-app-events-docs
-          delete-branch: true
-          base: main
