diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e415d9a44..039a426f9 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,4 +6,24 @@ Before submitting your PR, there are a few things you can do to make sure it goe - [ ] Ensure the linter passes (`./codeAnalysis` to automatically apply formatting/linting) - [ ] Appropriate docs were updated (if necessary) +## ๐Ÿ“ธ Proof of change (REQUIRED) + +> **Every PR must include a screen recording / video showing the change working.** +> **UI changes must also include before/after screenshots.** +> Just drag-and-drop the files into the boxes below โ€” GitHub will upload them. +> PRs without the required media will be flagged automatically and **cannot be merged**. + +### ๐ŸŽฅ Screen recording / video (always required) + + + +### ๐Ÿ–ผ๏ธ Screenshots (required for any UI change) + +| Before | After | +| ------ | ----- | +| | | + +- [ ] This change has **no user-visible / UI effect** (refactor, docs, CI, etc.), so screenshots are not applicable. + - A maintainer may also apply the `non-ui` label. **A video is still required** even for non-UI changes. + Fixes # ๐Ÿฆ• diff --git a/.github/workflows/require-pr-media.yml b/.github/workflows/require-pr-media.yml new file mode 100644 index 000000000..95e5ec96c --- /dev/null +++ b/.github/workflows/require-pr-media.yml @@ -0,0 +1,129 @@ +name: Require PR media + +# Ensures every PR includes a screen recording / video, and a screenshot for UI +# changes. Posts a friendly comment tagging the author when something is missing, +# and fails a status check so the PR cannot be merged until it is fixed. +# +# Escape hatch: apply the `non-ui` label (or tick the "no user-visible / UI effect" +# box in the PR description) to skip the screenshot requirement. A video is still +# required even for non-UI changes. + +on: + pull_request_target: + types: [opened, edited, reopened, synchronize, labeled, unlabeled] + +# pull_request_target runs in the base-repo context so we can comment on PRs from +# forks. We only read the PR body/labels and post a comment โ€” no untrusted code is +# checked out or executed. +permissions: + pull-requests: write + issues: write + +concurrency: + group: require-pr-media-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + check-media: + name: Check for screenshot & video + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const MARKER = ''; + const pr = context.payload.pull_request; + const body = pr.body || ''; + const author = pr.user.login; + + // --- Detect a screenshot (an embedded image) -------------------- + const hasScreenshot = + /!\[[^\]]*\]\([^)]+\)/.test(body) || // ![alt](url) markdown image + /]*>/i.test(body); // html + + // Strip embedded images so their URLs are not mistaken for a video. + const withoutImages = body + .replace(/!\[[^\]]*\]\([^)]*\)/g, ' ') + .replace(/]*>/gi, ' '); + + // --- Detect a video -------------------------------------------- + const hasVideo = + /\.(mp4|mov|webm|m4v|avi|mkv)\b/i.test(withoutImages) || // file extension + /]/i.test(withoutImages) || //