Skip to content

chore(governance): centralize PR gate and anti-leak hygiene #187

chore(governance): centralize PR gate and anti-leak hygiene

chore(governance): centralize PR gate and anti-leak hygiene #187

name: Engineering governance
on:
pull_request:
push:
branches: ["main"]
permissions:
contents: read
jobs:
gitleaks:
name: Gitleaks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Scan added commits with redacted findings
uses: Pigbibi/PrGovernance/pr-governance@ccda8de572d2893272b0137526ef3e2d45e5eee7
with:
mode: scan
commitlint:
name: Commit message convention
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Validate pull request commit messages
if: github.event_name == 'pull_request'
shell: bash
env:
PR_BASE: ${{ github.event.pull_request.base.sha }}
PR_HEAD: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
tool="$RUNNER_TEMP/governance-commitlint"
npm install --prefix "$tool" --ignore-scripts --no-audit --no-fund \
@commitlint/cli@21.2.4 @commitlint/config-conventional@21.2.4
printf '%s\n' "module.exports = {extends: [require.resolve('@commitlint/config-conventional')], defaultIgnores: true, ignores: [(message) => /^Merge /.test(message)], rules: {'subject-case': [0], 'header-max-length': [2, 'always', 72], 'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'refactor', 'test', 'chore', 'perf', 'ci']]}};" > "$tool/commitlint.config.cjs"
node "$tool/node_modules/@commitlint/cli/cli.js" \
--config "$tool/commitlint.config.cjs" --from "$PR_BASE" --to "$PR_HEAD" --verbose