Skip to content

Commit

Permalink
ci: Add GH workflow to validate PR titles follow Conventional Commits. (
Browse files Browse the repository at this point in the history
  • Loading branch information
davemarco authored Dec 12, 2024
1 parent 01aa3a5 commit d2556b2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!--
Set the PR title to a meaningful commit message in imperative form. E.g.:
linting: Print line and column number of violation (fixes #999).
Set the PR title to a meaningful commit message that:
- follows the Conventional Commits specification (https://www.conventionalcommits.org).
- is in imperative form.
Example:
fix: Don't add implicit wildcards ('*') at the beginning and the end of a query (fixes #390).
-->

# Description
<!-- Describe what this request will change/fix and provide any details necessary for reviewers. -->

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/pr-title-checks.yaml
Original file line number Diff line number Diff line change
@@ -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}}"

0 comments on commit d2556b2

Please sign in to comment.