Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
c1b6d4b
fix: reuse navbar styler and clean up resize listeners
boomzero Oct 3, 2026
d175414
3.8.1
github-actions[bot] Oct 3, 2026
0e3cbb5
Update version info to 3.8.1
github-actions[bot] Oct 3, 2026
519b281
fix: restore navbar styling and remove owned artifacts on teardown
boomzero Oct 3, 2026
965f08a
Update time and description of 3.8.1
github-actions[bot] Oct 3, 2026
51dc11e
Update time and description of 3.8.1
github-actions[bot] Oct 3, 2026
56c4989
Update time and description of 3.8.1
github-actions[bot] Oct 3, 2026
f21d58c
Update time and description of 3.8.1
github-actions[bot] Oct 3, 2026
ac477fe
fix: keep downloads out of the navbar spacer
boomzero Oct 3, 2026
4654237
Update time and description of 3.8.1
github-actions[bot] Oct 3, 2026
3fcc576
Update time and description of 3.8.1
github-actions[bot] Oct 3, 2026
a64b24a
fix: load the same monochrome fonts on web and classic pages
boomzero Oct 3, 2026
8381325
Update time and description of 3.8.1
github-actions[bot] Oct 3, 2026
8758133
Update time and description of 3.8.1
github-actions[bot] Oct 3, 2026
b46e5c2
Merge pull request #1036 from XMOJ-Script-dev/codex/fix-navbar-listen…
boomzero Oct 3, 2026
1aeb907
fix: use consistent Chinese navbar fallback fonts
boomzero Oct 3, 2026
66d0fbb
3.8.2
github-actions[bot] Oct 3, 2026
ac3405d
Update version info to 3.8.2
github-actions[bot] Oct 3, 2026
67dccb0
fix: support migrated account settings page
boomzero Oct 3, 2026
c9399b8
3.8.2
github-actions[bot] Oct 3, 2026
8a8a511
Update version info to 3.8.2
github-actions[bot] Oct 3, 2026
bc914f4
fix: preserve native account listeners and recover badge saves
boomzero Oct 4, 2026
1a9c480
Update time and description of 3.8.2
github-actions[bot] Oct 4, 2026
7350dfa
Update time and description of 3.8.2
github-actions[bot] Oct 4, 2026
a7efe58
fix: anchor navbar before Bootstrap CSS loads
boomzero Oct 4, 2026
c730563
Update time and description of 3.8.2
github-actions[bot] Oct 4, 2026
11dd0db
Merge pull request #1039 from XMOJ-Script-dev/codex/fix-navbar-cjk-font
boomzero Oct 4, 2026
977942a
Merge remote-tracking branch 'origin/dev' into codex/fix-account-page…
boomzero Oct 4, 2026
4da8acd
3.8.3
boomzero Oct 4, 2026
cc8aa97
Update version info to 3.8.3
github-actions[bot] Oct 4, 2026
149a6e6
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
4b4e262
fix: recover badge loads without overwriting unloaded values
boomzero Oct 4, 2026
f93813f
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
b88db84
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
719ed4b
fix: enforce Chinese across classic and web pages
boomzero Oct 4, 2026
7b2f167
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
c5b593d
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
7796bdc
fix: initialize badge editor on the current account page
boomzero Oct 4, 2026
993220e
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
862b7f4
fix: render complete profiles before optional requests
boomzero Oct 4, 2026
65e57e6
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
7301f4f
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
8bf7af7
fix: persist Chinese through current account settings and render prof…
boomzero Oct 4, 2026
bfc261a
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
cf481aa
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
fb35aaf
fix: draw profile submission history without the native renderer
boomzero Oct 4, 2026
616eb6b
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
076f82a
fix: separate dense profile history series into aligned panels
boomzero Oct 4, 2026
6737a97
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
a49a942
fix: soften overlapping history series and recover stashed API safegu…
boomzero Oct 4, 2026
f5eaedb
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
d1b7047
fix: add a theme-aware border around profile history
boomzero Oct 4, 2026
3544492
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
9f9c568
fix: add padding and spacing around profile history
boomzero Oct 4, 2026
4593892
Update time and description of 3.8.3
github-actions[bot] Oct 4, 2026
e816557
Merge pull request #1040 from XMOJ-Script-dev/codex/fix-account-page-…
boomzero Oct 4, 2026
40babdc
Redesign xmoj-script.uk in the userscript's monochrome style
boomzero Oct 4, 2026
96c57e1
Deploy the site on every push and keep the backend submodule current
boomzero Oct 4, 2026
f3e1746
fix: avoid cosmetic filters hiding the navbar spacer
boomzero Oct 4, 2026
cf40601
3.8.4
github-actions[bot] Oct 4, 2026
6b301f1
Update version info to 3.8.4
github-actions[bot] Oct 4, 2026
2e6a36f
fix: normalize filtered borrowed navbar spacers
boomzero Oct 4, 2026
1dd25d3
Update time and description of 3.8.4
github-actions[bot] Oct 4, 2026
7fca414
Merge pull request #1044 from XMOJ-Script-dev/codex/fix-navbar-spacer…
boomzero Oct 4, 2026
527e284
Use real script screenshots in the hero and fix the stretched logo
boomzero Oct 4, 2026
9fca6a0
Address review feedback, feature 短消息在线看, add EU notice
boomzero Oct 4, 2026
3c116a0
Correct short-message visibility: encrypted at rest, admins can't read
boomzero Oct 4, 2026
55d3433
Remove Microsoft Clarity and tighten the privacy notice
boomzero Oct 4, 2026
d08da3b
Add Edge 138+ user-script toggle step, lazy-load both hero images, se…
boomzero Oct 5, 2026
5ff72cf
Bump backend to a55c2b0 (session IDs no longer logged)
boomzero Oct 5, 2026
9a44614
fix: restore admin add-tag button for users without badges
boomzero Oct 5, 2026
b12fa82
3.8.5
github-actions[bot] Oct 5, 2026
98f6ac7
Update version info to 3.8.5
github-actions[bot] Oct 5, 2026
920b15f
Run xmoj-code-navigator on Sonnet
boomzero Oct 5, 2026
510a635
Merge pull request #1046 from XMOJ-Script-dev/chore/navigator-sonnet
boomzero Oct 5, 2026
128bc29
Merge remote-tracking branch 'origin/dev' into website-redesign
boomzero Oct 5, 2026
cb60e7e
Don't parse legacy EdgeHTML's Edge/ token as a Chromium Edge version
boomzero Oct 5, 2026
765d222
fix: handle missing tags consistently across account pages
boomzero Oct 5, 2026
6ec1bd5
Merge remote-tracking branch 'origin/dev' into codex/fix-profile-miss…
boomzero Oct 5, 2026
b4ef6b3
Update time and description of 3.8.5
github-actions[bot] Oct 5, 2026
865725d
Remove Deploy.yml: Cloudflare Pages' GitHub integration already deploys
boomzero Oct 5, 2026
8ca86c2
Merge pull request #1045 from XMOJ-Script-dev/codex/fix-profile-missi…
boomzero Oct 5, 2026
c7549b0
Point confused Chrome/Edge users to the illustrated install guide
boomzero Oct 5, 2026
0b517f9
Merge pull request #1043 from XMOJ-Script-dev/website-redesign
boomzero Oct 5, 2026
afea98e
Redesign user rating to reward skill instead of AC rate
boomzero Oct 5, 2026
ad2cc20
3.8.6
github-actions[bot] Oct 5, 2026
6f1453a
Update version info to 3.8.6
github-actions[bot] Oct 5, 2026
f3e93bf
Base rating accuracy on verdict totals, not per-problem counts
boomzero Oct 5, 2026
225d5ab
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
26b29a5
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
3c7ceba
Show rating colors on the web contest rank page
boomzero Oct 5, 2026
d6c5756
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
d69a4f2
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
00e839b
Match the web rank-correct page to the legacy OI rank styling
boomzero Oct 5, 2026
db57c1d
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
1d2e4a5
Let the web rank table overflow like the OI rank page
boomzero Oct 5, 2026
6a0f4b1
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
958e1fb
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
a6231fd
Show rank 1 instead of "Winner" on the web rank page
boomzero Oct 5, 2026
b10f64d
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
4c7b614
Remove ratings cached under the old key from localStorage
boomzero Oct 5, 2026
3da222b
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
e2de9fe
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
60b84a3
Use one readable rating palette on every page and theme
boomzero Oct 5, 2026
e5bdbb5
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
0a5778e
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
038d6b0
Restore a hover effect on rating-colored usernames
boomzero Oct 5, 2026
7757836
Update time and description of 3.8.6
github-actions[bot] Oct 5, 2026
1bbf8e1
Separate the red and orange rating colors
boomzero Oct 6, 2026
ffd6b47
Update time and description of 3.8.6
github-actions[bot] Oct 6, 2026
a42778b
Use the vivid orange for the second rating tier
boomzero Oct 6, 2026
503012b
Update time and description of 3.8.6
github-actions[bot] Oct 6, 2026
15c3902
Update time and description of 3.8.6
github-actions[bot] Oct 6, 2026
672d408
Update time and description of 3.8.6
github-actions[bot] Oct 6, 2026
6d9fd90
Count solved problems from links too when computing the rating
boomzero Oct 6, 2026
23c9c02
Update time and description of 3.8.6
github-actions[bot] Oct 6, 2026
63b7518
Merge pull request #1048 from XMOJ-Script-dev/redesign-rating
boomzero Oct 6, 2026
0111cc1
Show script admins with violet names instead of a badge
boomzero Oct 6, 2026
c4cb359
3.8.7
github-actions[bot] Oct 6, 2026
91128f6
Update version info to 3.8.7
github-actions[bot] Oct 6, 2026
98ac80c
Update time and description of 3.8.7
github-actions[bot] Oct 6, 2026
035839d
Merge pull request #1049 from XMOJ-Script-dev/admin-violet-names
boomzero Oct 6, 2026
63ebf7c
Don't treat video player images as enlargeable
boomzero Oct 6, 2026
a884c4b
3.8.8
github-actions[bot] Oct 6, 2026
ae76631
Update version info to 3.8.8
github-actions[bot] Oct 6, 2026
347755e
Keep the minimalist skin off the video player controls
boomzero Oct 6, 2026
9b27a51
Merge branch 'fix-video-thumb-enlarger' of https://github.com/XMOJ-Sc…
boomzero Oct 6, 2026
7bfbf7e
Update time and description of 3.8.8
github-actions[bot] Oct 6, 2026
64e6fdf
Give replay pages a page title
boomzero Oct 6, 2026
7b5d298
Merge branch 'fix-video-thumb-enlarger' of https://github.com/XMOJ-Sc…
boomzero Oct 6, 2026
d2f737f
Update time and description of 3.8.8
github-actions[bot] Oct 6, 2026
1bb14a7
Update time and description of 3.8.8
github-actions[bot] Oct 6, 2026
1213cac
Merge pull request #1051 from XMOJ-Script-dev/fix-video-thumb-enlarger
boomzero Oct 6, 2026
6c77877
Merge master into dev for the stable release
boomzero Oct 6, 2026
31c27eb
3.9.0
github-actions[bot] Oct 6, 2026
c1d1a2f
Update to release 3.9.0
github-actions[bot] Oct 6, 2026
4fc6152
Merge pull request #1054 from XMOJ-Script-dev/actions/temp
boomzero Oct 6, 2026
da5b1c7
Address review findings from the 3.9.0 release PR
boomzero Oct 6, 2026
ce63eaf
Open release version PRs with the GitHub App token
boomzero Oct 6, 2026
f117fe9
Address review on the navbar handler, wording and release workflow
boomzero Oct 6, 2026
eab4141
Retire extern-contrib workflows and harden workflows for fork PRs
boomzero Oct 6, 2026
5685b2a
Point external contributors at dev instead of extern-contrib
boomzero Oct 6, 2026
581153a
Bump the version for merged fork PRs from the push to dev
boomzero Oct 6, 2026
84fc889
Document the post-merge version bump for fork PRs
boomzero Oct 6, 2026
461e194
Serialize fork version bumps and only guard stable releases
boomzero Oct 6, 2026
0f68da7
Remove the retired Qodana workflow
boomzero Oct 6, 2026
75dd908
Merge pull request #1055 from XMOJ-Script-dev/fix-release-review
boomzero Oct 6, 2026
c61b03b
Release as 4.0.0: the rating redesign is a breaking change
boomzero Oct 6, 2026
0cf531d
remove //!ci-no-touch
github-actions[bot] Oct 6, 2026
aef1145
4.0.1
github-actions[bot] Oct 6, 2026
e8d840b
Update version info to 4.0.1
github-actions[bot] Oct 6, 2026
1e06997
Revert the accidental 4.0.1 bump from a PR edit
boomzero Oct 6, 2026
f974848
remove //!ci-no-touch
github-actions[bot] Oct 6, 2026
136e268
Merge pull request #1057 from XMOJ-Script-dev/bump-4.0.0
boomzero Oct 6, 2026
a40fcf0
Never bump the version on a PR edit
boomzero Oct 6, 2026
6b1612c
Update Update/UpdateVersion.js
boomzero Oct 6, 2026
e486b31
Merge pull request #1058 from XMOJ-Script-dev/updateversion-edited-no…
boomzero Oct 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/agents/xmoj-code-navigator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: xmoj-code-navigator
description: "Use this agent when you need to locate, retrieve, or understand specific sections of the XMOJ.user.js file without loading the entire file into context. This includes scenarios like:\\n\\n<example>\\nContext: The user is debugging a feature and needs to understand how login authentication works in XMOJ.user.js.\\nuser: \"Can you help me understand how the login flow works in XMOJ.user.js?\"\\nassistant: \"I'll use the Task tool to launch the xmoj-code-navigator agent to locate and retrieve the relevant login authentication code from XMOJ.user.js.\"\\n<commentary>\\nSince the user needs specific code from the large XMOJ.user.js file, use the xmoj-code-navigator agent to efficiently find and extract the relevant sections without loading the entire file.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: The user is adding a new feature and wants to see how similar features are implemented.\\nuser: \"I want to add a feature to handle quiz submissions. Can you show me how other submission handlers are implemented?\"\\nassistant: \"Let me use the xmoj-code-navigator agent to search through XMOJ.user.js for existing submission handler implementations.\"\\n<commentary>\\nThe user needs to reference existing patterns in the large file. The xmoj-code-navigator agent can efficiently locate and extract relevant code examples without overwhelming the context window.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: The user is reviewing code changes and needs to verify if a specific function exists.\\nuser: \"Does XMOJ.user.js have a function for parsing XML responses?\"\\nassistant: \"I'll use the xmoj-code-navigator agent to search for XML parsing functions in XMOJ.user.js.\"\\n<commentary>\\nThis is a targeted search task in a large file - perfect for the xmoj-code-navigator agent.\\n</commentary>\\n</example>"
tools: Glob, Grep, Read, WebFetch, WebSearch
model: haiku
model: sonnet
color: cyan
---

Expand Down
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ updates:
target-branch: "dev"
schedule:
interval: "weekly"
- package-ecosystem: "gitsubmodule"
directory: "/"
target-branch: "dev"
schedule:
interval: "daily"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: A daily gitsubmodule interval opens a Dependabot PR every time XMOJ-bbs's master advances, and each merged bump rides into the next stable release via the wholesale dev→master merge with no version bump and no test coverage: Test.yml's actions/checkout doesn't fetch submodules, so these updates are never executed by CI and only get whatever verification the release review provides. Align the interval with the release cadence (weekly/monthly), or cap the noise with open-pull-requests-limit, so backend code isn't promoted to dev (and eventually stable) on an automatic daily cadence.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/dependabot.yml, line 12:

<comment>A daily gitsubmodule interval opens a Dependabot PR every time XMOJ-bbs's master advances, and each merged bump rides into the next stable release via the wholesale dev→master merge with no version bump and no test coverage: Test.yml's actions/checkout doesn't fetch submodules, so these updates are never executed by CI and only get whatever verification the release review provides. Align the interval with the release cadence (weekly/monthly), or cap the noise with open-pull-requests-limit, so backend code isn't promoted to dev (and eventually stable) on an automatic daily cadence.</comment>

<file context>
@@ -5,3 +5,8 @@ updates:
+    directory: "/"
+    target-branch: "dev"
+    schedule:
+      interval: "daily"
</file context>
Suggested change
interval: "daily"
interval: "weekly"

17 changes: 12 additions & 5 deletions .github/workflows/Prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,19 @@ jobs:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
id: get_version
run: node ./Update/GetVersion.js
# 版本号没变(例如合并了没有更新版本号的 PR)时,不能把已发布的正式版覆盖成预发布版;同版本的预发布版照常更新
- name: Check for an existing release
id: existing_release
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
VERSION: ${{ steps.get_version.outputs.version }}
run: |
if [ "$(gh release view "$VERSION" --json isPrerelease --jq .isPrerelease 2>/dev/null)" = "false" ]; then
echo "Release $VERSION is already published as a stable release, skipping the prerelease."
echo exists=true >> $GITHUB_OUTPUT
fi
- id: create_release
if: steps.existing_release.outputs.exists != 'true'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
Expand All @@ -44,8 +56,3 @@ jobs:
prerelease: true
files: XMOJ.user.js
target_commitish: ${{ github.sha }}
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: .
- uses: actions/deploy-pages@v4
14 changes: 1 addition & 13 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Release
on:
workflow_dispatch:
push:
branches:
- master
paths:
- XMOJ.user.js
- .github/workflows/Release.yml
jobs:
Release:
runs-on: ubuntu-latest
Expand All @@ -20,7 +18,7 @@ jobs:
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/setup-node@v4
with:
node-version: 22
node-version: 16

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Downgrading to Node 16 breaks the Get version step: Update/GetVersion.js starts with import { readFileSync } from "fs" (ESM) and package.json has no "type": "module", so Node 16 throws SyntaxError: Cannot use import statement outside a module — the script only executes via Node 22+'s module-syntax detection (verified by running it under the sandbox's Node v22.22.3). The job aborts before create_release, so this merge's 3.9.0 release is never created. Keep node-version: 22. Note also that the release now fires only on XMOJ.user.js pushes and workflow_dispatch was removed, so a Release.yml-only fix commit will not re-trigger the release.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/Release.yml, line 21:

<comment>Downgrading to Node 16 breaks the `Get version` step: `Update/GetVersion.js` starts with `import { readFileSync } from "fs"` (ESM) and `package.json` has no `"type": "module"`, so Node 16 throws `SyntaxError: Cannot use import statement outside a module` — the script only executes via Node 22+'s module-syntax detection (verified by running it under the sandbox's Node v22.22.3). The job aborts before `create_release`, so this merge's 3.9.0 release is never created. Keep `node-version: 22`. Note also that the release now fires only on `XMOJ.user.js` pushes and `workflow_dispatch` was removed, so a Release.yml-only fix commit will not re-trigger the release.</comment>

<file context>
@@ -20,7 +18,7 @@ jobs:
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 16
           registry-url: https://registry.npmjs.org/
       - uses: actions/checkout@v6
</file context>
Suggested change
node-version: 16
node-version: 22

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This PR deletes the Cloudflare Pages and GitHub Pages deploy steps from both Release.yml and Prerelease.yml, and none of the 13 remaining files in .github/workflows/ deploys Pages or Cloudflare anymore. Unless the Pages/Cloudflare connections were reconfigured out-of-band (direct Git integration), xmoj-script.uk / the docs site stop receiving updates after this release while CLAUDE.md still documents that both push paths deploy to Cloudflare Pages and GitHub Pages. Confirm the deploys still happen, or keep the deploy steps.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/Release.yml, line 21:

<comment>This PR deletes the Cloudflare Pages and GitHub Pages deploy steps from both Release.yml and Prerelease.yml, and none of the 13 remaining files in `.github/workflows/` deploys Pages or Cloudflare anymore. Unless the Pages/Cloudflare connections were reconfigured out-of-band (direct Git integration), xmoj-script.uk / the docs site stop receiving updates after this release while `CLAUDE.md` still documents that both push paths deploy to Cloudflare Pages and GitHub Pages. Confirm the deploys still happen, or keep the deploy steps.</comment>

<file context>
@@ -20,7 +18,7 @@ jobs:
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 16
           registry-url: https://registry.npmjs.org/
       - uses: actions/checkout@v6
</file context>

registry-url: https://registry.npmjs.org/
- uses: actions/checkout@v6
with:
Expand All @@ -38,13 +36,3 @@ jobs:
draft: false
prerelease: false
files: XMOJ.user.js
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 89969bdf9d5ab8202f8ad8b8ae2c40b8
command: pages deploy . --project-name=xmoj-script --branch=master
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: .
- uses: actions/deploy-pages@v4
18 changes: 14 additions & 4 deletions .github/workflows/UpdateToRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,34 @@ on:
jobs:
UpdateToRelease:
runs-on: ubuntu-latest
# 添加条件:如果是 bot 触发的则跳过,避免无限循环
if: github.event.pull_request.user.login != 'github-actions[bot]'
# 添加条件:如果是 bot 触发的则跳过,避免无限循环;fork 的 PR 拿不到 secrets,也跳过
if: github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'github-actions[bot]'
permissions:
pull-requests: write
contents: write
steps:
# 用 GitHub App 的 token 创建版本 PR,这样它的工作流无需手动批准就能运行并自动合并
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: Update to release
run: |
if [[ ${{ github.event.pull_request.head.ref }} != dev && $(git diff --name-only HEAD HEAD~1) == *XMOJ.user.js* ]]; then
echo Closing PR
gh pr comment ${{ github.event.pull_request.number }} --body "请向\`dev\`分支提交pull request, 本pull request将被自动关闭"
gh pr close ${{ github.event.pull_request.number }}
else
node ./Update/UpdateToRelease.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.pull_request.number }} "$PR_BODY"
node ./Update/UpdateToRelease.js ${{ steps.generate_token.outputs.token }} ${{ github.event.pull_request.number }} "$PR_BODY"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
PR_BODY: ${{ github.event.pull_request.body }}
7 changes: 6 additions & 1 deletion .github/workflows/UpdateVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v6
- name: Update version
# PR 标题不可信,通过环境变量传入,不直接拼进 shell 命令
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
PR_NUMBER: ${{ github.event.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: node ./Update/UpdateVersion.js ${{ steps.generate_token.outputs.token }} ${{ github.event.number }} "${{ github.event.pull_request.title }}" "$PR_BODY" "${{ github.event.action }}"
PR_ACTION: ${{ github.event.action }}
run: node ./Update/UpdateVersion.js "$GITHUB_TOKEN" "$PR_NUMBER" "$PR_TITLE" "$PR_BODY" "$PR_ACTION"
54 changes: 54 additions & 0 deletions .github/workflows/UpdateVersionFork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: UpdateVersionFork
# fork 的 PR 拿不到 secrets,也不能推送到 fork,所以合并前没法更新版本号。
# 维护者合并后会推送到 dev:在这次(可信的)推送上找出所有已合并、但 Update.json 里还没有记录的 fork PR,
# 逐个基于最新的 dev 更新版本号,并以 GitHub App 身份开自动合并的 PR,等它合并后再处理下一个。
# 并发组最多保留一个排队的运行,被替换掉的运行要处理的 PR 也会被后面的运行补上。
on:
push:
branches:
- dev
paths:
- XMOJ.user.js
workflow_dispatch:
concurrency:
group: update-version-fork
cancel-in-progress: false
jobs:
UpdateVersionFork:
runs-on: ubuntu-latest
if: ${{ !endsWith(github.actor, '[bot]') }}
permissions:
contents: read
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- uses: actions/checkout@v6
with:
ref: dev
token: ${{ steps.generate_token.outputs.token }}
- name: Update versions of merged fork PRs
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
REPOSITORY: ${{ github.repository }}
# 在此之前合并的 fork PR 不再补记版本号
SINCE: "2026-10-06T00:00:00Z"
run: |
PRS=$(gh pr list --repo "$REPOSITORY" --base dev --state merged --limit 50 --json number,isCrossRepository,mergedAt \
--jq "map(select(.isCrossRepository and .mergedAt >= \"$SINCE\")) | sort_by(.mergedAt) | .[].number")
for PR_NUMBER in $PRS; do
git fetch -q origin dev
git checkout -q -B dev origin/dev
if jq -e --argjson pr "$PR_NUMBER" '[.UpdateHistory[].UpdateContents[].PR] | index($pr)' Update.json > /dev/null; then
echo "#$PR_NUMBER already has a version."
continue
fi
PR_TITLE=$(gh api "repos/$REPOSITORY/pulls/$PR_NUMBER" --jq .title)
PR_BODY=$(gh api "repos/$REPOSITORY/pulls/$PR_NUMBER" --jq '.body // ""')
node ./Update/UpdateVersion.js "$GITHUB_TOKEN" "$PR_NUMBER" "$PR_TITLE" "$PR_BODY" fork-merged
done
25 changes: 0 additions & 25 deletions .github/workflows/main.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/merge.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/sync-to-extern-contrib.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "backend"]
path = backend
url = https://github.com/XMOJ-Script-dev/XMOJ-bbs
branch = master
Loading
Loading