-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ci: Check commits in PRs #1122
ci: Check commits in PRs #1122
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heads up, the conventional commits check is failing.
Also, I like this idea from @evanlinjin: https://discord.com/channels/753336465005608961/999098651383189554/1152079701985210408
Do you think we could just have a few scripts checking if commits are signed and conventional instead, so that the check is easy to reproduce locally?
eeecb0f
to
2254a1d
Compare
Somehow |
A few comments:
|
Another suggestion, the |
b8f6706
to
ebff4b5
Compare
That's an amazing suggestion. Yeah I much prefer this one! I followed the instructions at https://github.com/cocogitto/cocogitto-action.
Let's change to
Done in ebff4b5.
Yes, but that feature is not automatically copied over to forks. |
NOTE to myself: - name: Conventional commit check
uses: cocogitto/cocogitto-action@v3
with:
check-latest-tag-only: true |
I think the only way to do this would be to use |
We can also merge now and not add conventional commits to the mandatory CI checks for PRs to be merged onto |
The reason behind a CI job would be to make the requirement for signed commits more explicit. What happened to me way to many times is that I would ack a PR and notice only later that the author didn't sign the commits, and usually this means waiting days/weeks before the author sees the comments and does something about it. Instead, if at the time of opening PR the CI fails because of signed commits, the author can quickly fix. |
Btw, we already use the bitcoin core method for merging PRs, using the github-merge.py script, maybe we should consider to also check the commits validity like Bitcoin Core does? In this way, we would add all the docs to verify the commits. |
This is a good reason to enable it. I've had to remind new committers (and sometimes not new) to sign commits, having CI on their forks to automatically notify folks would be useful. |
@danielabrozzoni, I've added two Git Hooks to the new directory I also added instructions to Here's an output: > git commit -m "test hook"
Error: Invalid commit message format. Please use a conventional commit message.
Commit message should match the pattern: ^(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\([[:alnum:]\-]+\))?:[[:space:]].*.
Please refer to https://www.conventionalcommits.org/en/v1.0.0/ for more details. > git commit --no-gpg-sign -m "ci: test hook"
[einherjar/ci-commits 205b54c] ci: test hook
3 files changed, 53 insertions(+), 5 deletions(-)
create mode 100755 ci/git-hooks/conventional-commits.sh
create mode 100755 ci/git-hooks/signed-commits.sh
> git push
Error: Last commit (205b54cd7caf6b86d53699177137280e91be7c00) is not signed.
error: failed to push some refs to 'https://github.com/realeinherjar/bdk.git' |
883e571
to
9f2359c
Compare
Thanks! I see that the conventional commits check is failing on the merge commits (for example 59fc1b3), is there a way to configure it to allow them? |
That is only possible with a This is documented in the cocogitto docs. |
Closes bitcoindevkit#1119. Creates `commits.yml` in `.github/workflows/` directory with a new GH Action that has 2 jobs: 1. `signed-commits`: uses [`1Password/check-signed-commits-action`](https://github.com/1Password/check-signed-commits-action) to check if all commits in the PR are signed. 1. `conventional-commits`: uses [`cocogitto/cocogitto-action`](https://github.com/cocogitto/cocogitto-action) based on [`cocogitto`](https://crates.io/crates/cocogitto) to check if all commits in the PR follows the conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/), i.e. they are prefixed with `fix`, `refactor`, `feat` etc.
- `signed-commits.sh` hook (a `pre-push` hook) will not allow the user to push to remote if the last commit is not signed. This is a good sanity test,if the last commit is signed then there is a high chance of any other previous are also signed. - `conventional-commits.sh` hook (a `commit-msg` hook) will not allow the user to commit if the commit message does not satisfy the Conventional Commits template.
`ignore_merge_commits` set to `true` will ignore `Merge ...` like in 59fc1b3.
8a518e8
to
9e99fee
Compare
@realeinherjar Is this PR still needed or will these checks be rolled into #1165? |
This is superseded by #1165. |
Closes #1119.
Creates
commits.yml
in.github/workflows/
directory with a new GH Actionthat has 2 jobs:
signed-commits
: uses [1Password/check-signed-commits-action
(https://github.com/1Password/check-signed-commits-action)to check if all commits in the PR are signed.
conventional-commits
: usescocogitto/cocogitto-action
based on
cocogitto
to check if all commits in the PR follows the conventional commits,
i.e. they are prefixed with
fix
,refactor
,feat
etc.Clarifies the "Commit policy"
CONTRIBUTING.md
:cocogitto/cocogitto
.Two Git Hooks
to the new directory
ci/git-hooks
signed-commits.sh
hook (apre-push
hook)will not allow the user to push to remote if the last commit is not signed.
This is a good sanity test,if the last commit is signed then there is a high chance
of any other previous are also signed.
conventional-commits.sh
hook (acommit-msg
hook) will not allow the user to commitif the commit message does not satisfy the Conventional Commits template.
Notes to the reviewers
Since this is a big enforcement change,
we can for now not make this CI check mandatory for a PR to be merged.
When appropriate we can turn check mandatory.
Also none of these actions have write permissions.
Changelog notice
Added CI checks for signed commits and conventional commits guidelines.
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
CONTRIBUTING.md
)Bugfixes: