mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-25 12:30:19 +01:00
ci: Add pull request template and run commitlint on PR title only
We now ensure the conventional commits format only on PR titles and not on commits to let developers keep commit messages targeted for other developers i.e. describe actual changes to code that users should not care about. And PR titles, on the contrary, must be aimed at end users. For more info, see https://linux-system-roles.github.io/contribute.html#write-a-good-pr-title-and-description
This commit is contained in:
parent
9f26414a37
commit
1a7d995b96
2 changed files with 13 additions and 16 deletions
7
.github/pull_request_template.md
vendored
Normal file
7
.github/pull_request_template.md
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Enhancement:
|
||||||
|
|
||||||
|
Reason:
|
||||||
|
|
||||||
|
Result:
|
||||||
|
|
||||||
|
Issue Tracker Tickets (Jira or BZ if any):
|
22
.github/workflows/commitlint.yml
vendored
22
.github/workflows/commitlint.yml
vendored
|
@ -11,6 +11,8 @@ on: # yamllint disable-line rule:truthy
|
||||||
- main
|
- main
|
||||||
types:
|
types:
|
||||||
- checks_requested
|
- checks_requested
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
jobs:
|
jobs:
|
||||||
commit-checks:
|
commit-checks:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -22,20 +24,8 @@ jobs:
|
||||||
- name: Install conventional-commit linter
|
- name: Install conventional-commit linter
|
||||||
run: npm install @commitlint/config-conventional @commitlint/cli
|
run: npm install @commitlint/config-conventional @commitlint/cli
|
||||||
|
|
||||||
# Finding the commit range is not as trivial as it may seem.
|
|
||||||
#
|
|
||||||
# At this stage, git's HEAD does not refer to the latest commit in the
|
|
||||||
# PR, but rather to the merge commit inserted by the PR. So instead we
|
|
||||||
# have to get 'HEAD' from the PR event.
|
|
||||||
#
|
|
||||||
# One cannot use the number of commits
|
|
||||||
# (github.event.pull_request.commits) to find the start commit
|
|
||||||
# i.e. HEAD~N does not work, this breaks if there are merge commits.
|
|
||||||
- name: Run commitlint on commits
|
|
||||||
run: >-
|
|
||||||
npx commitlint --from '${{ github.event.pull_request.base.sha }}'
|
|
||||||
--to '${{ github.event.pull_request.head.sha }}' --verbose
|
|
||||||
|
|
||||||
- name: Run commitlint on PR title
|
- name: Run commitlint on PR title
|
||||||
run: |
|
run: >-
|
||||||
echo '${{ github.event.pull_request.title }}' | npx commitlint --verbose
|
echo '${{ github.event.pull_request.title }}' |
|
||||||
|
npx commitlint --verbose
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue