From 38f5c79d7025d55febde1c0e7faee97fa98a4c3a Mon Sep 17 00:00:00 2001 From: rldyourmnd Date: Tue, 4 Aug 2026 15:51:23 +0500 Subject: [PATCH] feat: extend pr-hygiene with pr-title and stale options Signed-off-by: rldyourmnd --- .github/workflows/pr-hygiene.yml | 48 ++++++++++++++++++++++++++++++++ CHANGELOG.md | 8 ++++++ catalog/capabilities.yml | 3 +- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-hygiene.yml b/.github/workflows/pr-hygiene.yml index d297084..77c3563 100644 --- a/.github/workflows/pr-hygiene.yml +++ b/.github/workflows/pr-hygiene.yml @@ -18,6 +18,18 @@ on: pr_title: type: boolean default: true + pr_title_types: + description: 'Comma-separated allowed conventional-commit types (e.g. feat,fix). Empty uses the action defaults.' + type: string + default: '' + pr_title_require_scope: + description: 'Require a scope in every PR title.' + type: boolean + default: false + pr_title_subject_pattern: + description: 'Regex constraining the PR title subject. Empty applies no extra subject validation.' + type: string + default: '' labeler: type: boolean default: false @@ -33,6 +45,18 @@ on: days_before_close: type: number default: 14 + stale_operations_per_run: + description: 'Maximum number of operations per run for the stale job.' + type: number + default: 30 + stale_exempt_issue_labels: + description: 'Comma-separated issue labels that exempt an issue from stale processing. Empty disables the exemption.' + type: string + default: '' + stale_exempt_pr_labels: + description: 'Comma-separated PR labels that exempt a pull request from stale processing. Empty disables the exemption.' + type: string + default: '' timeout_minutes: type: number default: 10 @@ -67,8 +91,29 @@ jobs: contents: read pull-requests: read # the action reads the pull request it validates steps: + - name: Normalize PR-title options + id: pr_title_opts + shell: bash + env: + PR_TITLE_TYPES: ${{ inputs.pr_title_types }} + run: | + set -euo pipefail + # amannn/action-semantic-pull-request expects newline-delimited types; + # callers pass a comma-separated list. Convert commas to newlines and + # trim, leaving the output empty when no types were supplied (the action + # then falls back to its Conventional Commits defaults). + types_newline="$(printf '%s' "$PR_TITLE_TYPES" | tr ',' '\n' | sed '/^[[:space:]]*$/d')" + { + printf 'pr_title_types<> "$GITHUB_OUTPUT" - name: Validate PR title (Conventional Commits) uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 + with: + types: ${{ steps.pr_title_opts.outputs.pr_title_types }} + requireScope: ${{ inputs.pr_title_require_scope }} + subjectPattern: ${{ inputs.pr_title_subject_pattern }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -101,3 +146,6 @@ jobs: with: days-before-stale: ${{ inputs.days_before_stale }} days-before-close: ${{ inputs.days_before_close }} + operations-per-run: ${{ inputs.stale_operations_per_run }} + exempt-issue-labels: ${{ inputs.stale_exempt_issue_labels }} + exempt-pr-labels: ${{ inputs.stale_exempt_pr_labels }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e3876c..ffad859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ ### Added +- **`pr-hygiene.yml` grew pr-title and stale options.** The `pr-title` job now + accepts `pr_title_types` (comma-separated conventional-commit types, converted + to the newline-delimited `types:` the action expects; empty keeps the action + defaults), `pr_title_require_scope`, and `pr_title_subject_pattern`. The + `stale` job now accepts `stale_operations_per_run`, + `stale_exempt_issue_labels`, and `stale_exempt_pr_labels`. All default to the + prior behaviour, so existing callers are unaffected. + - **`clusterfuzzlite.yml` — ClusterFuzzLite PR (code-change) and batch fuzzing.** Reusable CFLite workflow with sanitizer matrix, configurable mode, fuzz duration, and SARIF output. Distinct from `fuzzing.yml` (cargo-fuzz). diff --git a/catalog/capabilities.yml b/catalog/capabilities.yml index 1896891..572e007 100644 --- a/catalog/capabilities.yml +++ b/catalog/capabilities.yml @@ -1291,8 +1291,9 @@ capabilities: - "labeler on fork PRs needs pull_request_target, which this library intentionally avoids; use it for same-repo PRs" - "Callers must grant the union of the enabled jobs' permissions" - "A caller cannot grant a reusable more than the reusable declares, so a missing scope here needs a library fix, not a caller change" + - "pr_title_types is comma-separated at the input boundary but converted to the newline-delimited `types:` the action expects; leaving it empty keeps the Conventional Commits defaults" deprecations: null - last_verified: "2026-07-08" + last_verified: "2026-08-04" sources: - "https://github.com/wagoid/commitlint-github-action" - "https://github.com/actions/labeler"