From 222af93455f4fec5abbc62674d75ead64dcee1a8 Mon Sep 17 00:00:00 2001 From: Ryan Millard <142347829+Ryan-Millard@users.noreply.github.com> Date: Sat, 31 Jan 2026 00:53:01 +0200 Subject: [PATCH 01/11] ci(stale.yml): Configure stale workflow with new settings Updated stale issue and PR messages, added days before stale and close settings, and exempt labels. --- .github/workflows/stale.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..fd3a25846 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,29 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '0 2 * * *' # every day at 02:00 UTC + workflow_dispatch: + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue has been inactive for 60 days. Please comment if it is still relevant or it will be closed in 14 days.' + stale-pr-message: 'This pull request has been inactive for 60 days. Please update it or it will be closed in 14 days.' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' + days-before-stale: 60 + days-before-close: 14 + exempt-labels: 'pinned,important' From fcee7bead330dc126f0b6404ae3ae419f8586c2a Mon Sep 17 00:00:00 2001 From: Ryan-Millard Date: Sat, 31 Jan 2026 01:04:18 +0200 Subject: [PATCH 02/11] style(stale-workflow): format properly --- .github/workflows/stale.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index fd3a25846..6e3271c17 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -6,7 +6,7 @@ name: Mark stale issues and pull requests on: schedule: - - cron: '0 2 * * *' # every day at 02:00 UTC + - cron: "0 2 * * *" # every day at 02:00 UTC workflow_dispatch: jobs: @@ -20,10 +20,10 @@ jobs: - uses: actions/stale@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'This issue has been inactive for 60 days. Please comment if it is still relevant or it will be closed in 14 days.' - stale-pr-message: 'This pull request has been inactive for 60 days. Please update it or it will be closed in 14 days.' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' + stale-issue-message: "This issue has been inactive for 60 days. Please comment if it is still relevant or it will be closed in 14 days." + stale-pr-message: "This pull request has been inactive for 60 days. Please update it or it will be closed in 14 days." + stale-issue-label: "no-issue-activity" + stale-pr-label: "no-pr-activity" days-before-stale: 60 days-before-close: 14 - exempt-labels: 'pinned,important' + exempt-labels: "pinned,important" From 099639d895a29e230744a76e8bf4ca36a848da1e Mon Sep 17 00:00:00 2001 From: Ryan-Millard Date: Sat, 31 Jan 2026 01:06:46 +0200 Subject: [PATCH 03/11] deps(stale-workflow): bump to newer v10 --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 6e3271c17..3393d2152 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -17,7 +17,7 @@ jobs: pull-requests: write steps: - - uses: actions/stale@v5 + - uses: actions/stale@v10 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: "This issue has been inactive for 60 days. Please comment if it is still relevant or it will be closed in 14 days." From 18d156d74e60994e30cd469c9ba4aa3b0a6d619f Mon Sep 17 00:00:00 2001 From: Ryan Millard <142347829+Ryan-Millard@users.noreply.github.com> Date: Sat, 31 Jan 2026 01:11:07 +0200 Subject: [PATCH 04/11] ci(stale.yml): fix label inputs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3393d2152..59aa4c92e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -26,4 +26,5 @@ jobs: stale-pr-label: "no-pr-activity" days-before-stale: 60 days-before-close: 14 - exempt-labels: "pinned,important" + exempt-issue-labels: "pinned,important" + exempt-pr-labels: "pinned,important" From ae46cffccbfa25526d9851685d545cb5b1f1b8a4 Mon Sep 17 00:00:00 2001 From: Ryan-Millard Date: Sat, 31 Jan 2026 02:27:12 +0200 Subject: [PATCH 05/11] docs(PR-template): update PR template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1c307ae58..1a08930d8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -15,7 +15,7 @@ Please note that by submitting this pull request to **Img2Num**, you confirm tha -Fixes: +Fixes: # ## Changes From df3390a577738aba6f7c96df04b24bca897cf8e9 Mon Sep 17 00:00:00 2001 From: Ryan-Millard Date: Sat, 31 Jan 2026 02:27:30 +0200 Subject: [PATCH 06/11] ci: add PR auto-label workflow and labeler config --- .github/labeler.yml | 22 ++++++++++++++++++++++ .github/workflows/pr-auto-label.yml | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/pr-auto-label.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..f5f5b079b --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,22 @@ +c/cpp: + - "**/*.c" + - "**/*.cpp" + - "**/*.h" + - "**/*.hpp" + +docs: + - "**/*.md" + +ci: + - ".github/**" + +js/ts: + - "**/*.js" + - "**/*.jsx" + - "**/*.ts" + - "**/*.tsx" + - "vite.config.*" # Vite config files + - "vite.*.js" # optional extra patterns + - "package.json" # package manifest changes + - "package-lock.json" + - "yarn.lock" diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml new file mode 100644 index 000000000..461356907 --- /dev/null +++ b/.github/workflows/pr-auto-label.yml @@ -0,0 +1,22 @@ +# This workflow will triage pull requests and apply a label based on the +# paths that are modified in the pull request. +# +# To use this workflow, you will need to set up a .github/labeler.yml +# file with configuration. For more information, see: +# https://github.com/actions/labeler + +name: Labeler +on: [pull_request_target] + +jobs: + label: + + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" From a74a22be6efc1947d9c016984bfd90c6e87e503c Mon Sep 17 00:00:00 2001 From: Ryan-Millard Date: Sat, 31 Jan 2026 02:27:54 +0200 Subject: [PATCH 07/11] ci: PR heading and body checker --- .github/workflows/pr-check.yml | 104 +++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 .github/workflows/pr-check.yml diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 000000000..648653981 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,104 @@ +name: PR Validation + +on: + pull_request: + types: [opened, edited, reopened, synchronize] + +jobs: + + title-check: + runs-on: ubuntu-latest + steps: + - name: Check PR title + uses: actions/github-script@v7 + with: + script: | + const pr = context.payload.pull_request; + const title = pr.title; + + const isWip = title.startsWith("WIP:"); + const isDraft = pr.draft; + + const conventionalRegex = + /^(build|ci|chore|docs|feat|fix|perf|refactor|revert|style|test)(\([^)]+\))?(!)?: .+/; + + if (isDraft || isWip) { + core.info("Draft or WIP PR detected — skipping title enforcement."); + return; + } + + if (!conventionalRegex.test(title)) { + core.setFailed( + `Invalid PR title.\n\n` + + `Expected:\n` + + `type(scope)!: description\n\n` + + `Allowed types:\n` + + `build, ci, chore, docs, feat, fix, perf, refactor, revert, style, test\n\n` + + `Examples:\n` + + `- feat: new feature\n` + + `- fix(scope): bug in scope\n` + + `- feat!: breaking change\n` + + `- chore(deps): update dependencies\n\n` + + `If this is WIP, prefix the title with "WIP:" or convert the PR to Draft.` + ); + } + + body-check: + needs: title-check + runs-on: ubuntu-latest + steps: + - name: Validate PR body + uses: actions/github-script@v7 + with: + script: | + const pr = context.payload.pull_request; + const body = pr.body || ""; + const title = pr.title || ""; + + const isDraft = pr.draft; + const isWip = title.startsWith("WIP:"); + + if (isDraft || isWip) { + core.info("Draft or WIP PR — skipping body enforcement."); + return; + } + + const requiredSections = [ + "## What was changed & why", + "## Changes", + "## Testing & Verification" + ]; + + const missingSections = requiredSections.filter( + section => !body.includes(section) + ); + + if (missingSections.length > 0) { + core.setFailed( + `PR body is missing the following required sections:\n` + + missingSections.join("\n") + + `\n\nPlease add these sections to your PR body.` + ); + } + + // Check for multiple issue references like "fixes #2" or "fixes: #2" + const issueReferences = [...body.matchAll(/(fixes|closes|resolves)\s*:?\s*#\d+/gi)]; + + const hasNone = /\bnone\b/i.test(body); + + // Convert matchAll result to boolean + const hasIssueKeyword = issueReferences.length > 0; + + // Fail only if neither issue references nor "none" exists + if (!hasIssueKeyword && !hasNone) { + core.setFailed( + `PR must reference an issue or explicitly state "none".\n\n` + + `Use one or more of the following keywords:\n` + + `- Fixes #\n` + + `- Closes #\n` + + `- Resolves #\n\n` + + `You can list multiple issues:\n` + + `fixes #2\nfixes: #3\n\n` + + `If no issue applies, write "none" in the PR body.` + ); + } From dd1f722cb31862dc303688046cb68fcc32e2c4a2 Mon Sep 17 00:00:00 2001 From: Ryan Millard <142347829+Ryan-Millard@users.noreply.github.com> Date: Sat, 31 Jan 2026 02:30:18 +0200 Subject: [PATCH 08/11] fix: workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/pr-check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 648653981..1a61fa755 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -1,5 +1,8 @@ name: PR Validation +permissions: + contents: read + on: pull_request: types: [opened, edited, reopened, synchronize] From ef10fb1b30cc71fad669e828b9c082547ce5ff6b Mon Sep 17 00:00:00 2001 From: Ryan-Millard Date: Sat, 31 Jan 2026 02:33:28 +0200 Subject: [PATCH 09/11] style(workflows): format new workflow files --- .github/labeler.yml | 6 +++--- .github/workflows/pr-auto-label.yml | 7 +++---- .github/workflows/pr-check.yml | 1 - 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index f5f5b079b..f2b7d9b3e 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -15,8 +15,8 @@ js/ts: - "**/*.jsx" - "**/*.ts" - "**/*.tsx" - - "vite.config.*" # Vite config files - - "vite.*.js" # optional extra patterns - - "package.json" # package manifest changes + - "vite.config.*" # Vite config files + - "vite.*.js" # optional extra patterns + - "package.json" # package manifest changes - "package-lock.json" - "yarn.lock" diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml index 461356907..92b13d05d 100644 --- a/.github/workflows/pr-auto-label.yml +++ b/.github/workflows/pr-auto-label.yml @@ -10,13 +10,12 @@ on: [pull_request_target] jobs: label: - runs-on: ubuntu-latest permissions: contents: read pull-requests: write steps: - - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 1a61fa755..6b6a2aed8 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -8,7 +8,6 @@ on: types: [opened, edited, reopened, synchronize] jobs: - title-check: runs-on: ubuntu-latest steps: From d793964aee3642cf99f5a8d2e57b2fe571d65aae Mon Sep 17 00:00:00 2001 From: Ryan-Millard Date: Mon, 2 Feb 2026 16:25:51 +0200 Subject: [PATCH 10/11] ci(deps): bump labeler to v6 --- .github/workflows/pr-auto-label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml index 92b13d05d..c1ae533b0 100644 --- a/.github/workflows/pr-auto-label.yml +++ b/.github/workflows/pr-auto-label.yml @@ -16,6 +16,6 @@ jobs: pull-requests: write steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v6 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" From af21882b0ff19f145024677a1db5e232f699c6df Mon Sep 17 00:00:00 2001 From: Ryan-Millard Date: Mon, 2 Feb 2026 16:32:53 +0200 Subject: [PATCH 11/11] ci(pr-check): fix permissions --- .github/workflows/pr-check.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 6b6a2aed8..e7a822f19 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -1,14 +1,14 @@ name: PR Validation -permissions: - contents: read - on: pull_request: types: [opened, edited, reopened, synchronize] jobs: title-check: + permissions: + contents: read + pull-requests: read runs-on: ubuntu-latest steps: - name: Check PR title @@ -46,6 +46,9 @@ jobs: } body-check: + permissions: + contents: read + pull-requests: read needs: title-check runs-on: ubuntu-latest steps: