From c7a73521c03f8cd9eefe4ed08d52d0096c71ca9e Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Wed, 6 Sep 2023 22:30:13 -0700 Subject: [PATCH] ci: enforce conventional commits in PR titles (#7) Uses https://github.com/amannn/action-semantic-pull-request. We will also need to change the default settings to encourage squashes. See https://github.blog/changelog/2022-05-11-default-to-pr-titles-for-squash-merge-commit-messages/ https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests I typically keep merge commits when the associated commits follow conventional commits. We could prefix with `chore:` closes #5 --- .github/workflows/lint_pr_title.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/lint_pr_title.yaml diff --git a/.github/workflows/lint_pr_title.yaml b/.github/workflows/lint_pr_title.yaml new file mode 100644 index 00000000..9ac4d6da --- /dev/null +++ b/.github/workflows/lint_pr_title.yaml @@ -0,0 +1,21 @@ +# https://github.com/amannn/action-semantic-pull-request +name: "Lint PR against Conventional Commits" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file