Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ALL] - feat: add tools to ensure commits are signed and renovate pr-commt-config #3567

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

flavienSindou
Copy link
Contributor

@flavienSindou flavienSindou commented Mar 5, 2025

Proposed changes

  • Manually renovate pre-commit-config linters version
  • Add pre-commit-config to renovate bot
  • Add pre-push hook to check if commits are signed
  • Alter PR Template to remind contributor to sign their commits

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality using different use cases
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

How to test

# Setup
python -m pip install pre-commit
pre-commit install --hook-type pre-commit --hook-type pre-push

git checkout -b "test_branch"

touch test.py
echo "import os" > test.py

git add test.py

git commit -m "signed commit with flake8 error" -S

echo 'import os

_ = os.environ' > test.py

git add test.py

git commit -m "unsigned commit" --no-gpg-sign

git push -u origin test_branch

# clean up
git checkout master
git branch -D test_branch 
rm test.py

@flavienSindou flavienSindou linked an issue Mar 5, 2025 that may be closed by this pull request
@flavienSindou flavienSindou self-assigned this Mar 5, 2025
@flavienSindou flavienSindou added the technical improvement Technical refactor or improvement is needed label Mar 5, 2025
@flavienSindou flavienSindou added this to the PRs backlog milestone Mar 5, 2025
@flavienSindou flavienSindou linked an issue Mar 5, 2025 that may be closed by this pull request
hooks:
- id: gpg-signed-commit
name: GPG Signed Commit Check
entry: bash -c 'for commit_sha in $(git log --pretty=%h master..); do git verify-commit "$commit_sha" || echo "error unisgned commit $commit_sha" && exit 1; done'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git log --pretty=%h master.. # list commit hash diff with master

git verify-commit # echo gpg:... if signed with gpg else exit 1

@flavienSindou flavienSindou removed this from the PRs backlog milestone Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical improvement Technical refactor or improvement is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ALL] - Add checks to ensure commits are signed wit gpg key [ALL] - Renovate pre-commit-config
1 participant