Skip to content
Merged
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Release
on:
workflow_dispatch:
push:
branches:
- master
paths:
- XMOJ.user.js
- .github/workflows/Release.yml
jobs:
Release:
runs-on: ubuntu-latest
Comment on lines 11 to 12

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.

issue (broader_impact): A manually dispatched run can be started against any branch, but the job checks out that selected ref and deploys it to the Cloudflare master branch, while also creating a release from that ref. Running it from a stale or development branch publishes the wrong userscript to production.

Triggers: When a maintainer selects a ref other than master in the manual workflow dispatch UI.

Suggested fix: Restrict manual runs to master with a job-level condition, or require and validate a master ref before creating the release and deploying.

Suggested change
Release:
runs-on: ubuntu-latest
Release:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest

Expand All @@ -18,7 +20,7 @@ jobs:
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 22
registry-url: https://registry.npmjs.org/
- uses: actions/checkout@v6
with:
Expand All @@ -36,12 +38,11 @@ jobs:
draft: false
prerelease: false
files: XMOJ.user.js
- uses: cloudflare/pages-action@v1
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 89969bdf9d5ab8202f8ad8b8ae2c40b8
projectName: xmoj-script
directory: .
command: pages deploy . --project-name=xmoj-script --branch=master
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
Expand Down
Loading