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

common/scripts/lint-commits: check commit author github account #40399

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Expand Up @@ -24,6 +24,7 @@ jobs:
PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
XLINT: '1'
LICENSE_LIST: common/travis/license.lst
GH_PR_NUM: ${{ github.event.number }}

steps:
- uses: actions/checkout@v1
Expand Down
12 changes: 11 additions & 1 deletion common/scripts/lint-commits
Expand Up @@ -37,7 +37,7 @@ do
(NF > 2) && (length > 80) { print "::error title=Commit Lint::" C ": long line: " $0; exit 1 }
!subject {
if (length > 50) { print "::warning title=Commit Lint::" C ": subject is a bit long" }
if (!($0 ~ ":" || $0 ~ "^Take over maintainership " || $0 ~ "^Orphan ")) { print "::error title=Commit Lint::" C ": subject does not follow CONTRIBUTING.md guildelines"; exit 1 }
if (!($0 ~ ":" || $0 ~ "^Take over maintainership " || $0 ~ "^Orphan ")) { print "::error title=Commit Lint::" C ": subject does not follow CONTRIBUTING.md guidelines"; exit 1 }
# Below check is too noisy?
# if (!($0 ~ "^New package:" || $0 ~ ".*: update to")) {
# print "::warning title=Commit Lint::" C ": not new package/update/removal?"
Expand All @@ -48,4 +48,14 @@ do
!body { print "::error title=Commit Lint::" C ": second line must be blank"; exit 1 }
' || status=1
done

if [ "$GITHUB_ACTIONS" = "true" ] && [ "$GH_PR_NUM" ]; then
gh api repos/void-linux/void-packages/pulls/$GH_PR_NUM/commits -t "{{range .}}{{slice .sha 0 8}}:{{.committer.login}}:{{.author.login}}{{end}}" |
awk -F: '
BEGIN { E=0 }
($1 ~ /^$/) { print "::error title=Commit Lint::" $0 ": no GitHub account associated with committer"; E=1 }
($2 ~ /^$/) { print "::error title=Commit Lint::" $0 ": no GitHub account associated with commit author"; E=1 }
END { exit $E }' || status=1
fi

exit $status