From 9cbdaff66cc4bf8218a31aaa75feafba496fd119 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Wed, 15 Jan 2025 16:32:35 -0500 Subject: [PATCH] Add PR template and GH workflow to validate PR titles following Conventional Commits. --- .github/PULL_REQUEST_TEMPLATE.md | 14 ++++++++++++ .github/workflows/pr-title-checks.yaml | 30 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/pr-title-checks.yaml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..7994e706 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ + + +# Description + + + +# Validation performed + diff --git a/.github/workflows/pr-title-checks.yaml b/.github/workflows/pr-title-checks.yaml new file mode 100644 index 00000000..0aed19ce --- /dev/null +++ b/.github/workflows/pr-title-checks.yaml @@ -0,0 +1,30 @@ +name: "pr-title-checks" + +on: + pull_request_target: + # NOTE: Workflows triggered by this event give the workflow access to secrets and grant the + # `GITHUB_TOKEN` read/write repository access by default. So we need to ensure: + # - This workflow doesn't inadvertently check out, build, or execute untrusted code from the + # pull request triggered by this event. + # - Each job has `permissions` set to only those necessary. + types: ["edited", "opened", "reopened"] + branches: ["main"] + +permissions: {} + +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + + # Cancel in-progress jobs for efficiency + cancel-in-progress: true + +jobs: + conventional-commits: + permissions: + # For amannn/action-semantic-pull-request + pull-requests: "read" + runs-on: "ubuntu-latest" + steps: + - uses: "amannn/action-semantic-pull-request@v5" + env: + GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"