Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] common/scripts/lint-commits: check commit author github account
@ 2022-11-09  0:16 classabbyamp
  2023-02-07  2:27 ` github-actions
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: classabbyamp @ 2022-11-09  0:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages ci/committer-gh-check
https://github.com/void-linux/void-packages/pull/40399

common/scripts/lint-commits: check commit author github account
Recently, CONTRIBUTING.md added a line about ensuring the email used to commit is associated with a github account. This should be able to lint all commits in a PR to ensure that condition.

While it is using API calls, it should only cost 1 call per CI run.

Will test this soon and refine the implementation.

#### Testing the changes
- I tested the changes in this PR: **NO**



A patch file from https://github.com/void-linux/void-packages/pull/40399.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/committer-gh-check-40399.patch --]
[-- Type: text/x-diff, Size: 2437 bytes --]

From a1feb79e88e3d43d7f1ed341a74fd4896a87aba1 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Tue, 8 Nov 2022 19:12:45 -0500
Subject: [PATCH] common/scripts/lint-commits: check commit author github
 account

---
 .github/workflows/build.yaml |  1 +
 common/scripts/lint-commits  | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 95f1cd88e338..454ffbaf2680 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -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
diff --git a/common/scripts/lint-commits b/common/scripts/lint-commits
index 6aea99d51154..582d44c79ca1 100755
--- a/common/scripts/lint-commits
+++ b/common/scripts/lint-commits
@@ -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?"
@@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: common/scripts/lint-commits: check commit author github account
  2022-11-09  0:16 [PR PATCH] common/scripts/lint-commits: check commit author github account classabbyamp
@ 2023-02-07  2:27 ` github-actions
  2023-05-09  1:52 ` github-actions
  2023-06-14  7:24 ` [PR PATCH] [Closed]: " classabbyamp
  2 siblings, 0 replies; 4+ messages in thread
From: github-actions @ 2023-02-07  2:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/40399#issuecomment-1420106091

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: common/scripts/lint-commits: check commit author github account
  2022-11-09  0:16 [PR PATCH] common/scripts/lint-commits: check commit author github account classabbyamp
  2023-02-07  2:27 ` github-actions
@ 2023-05-09  1:52 ` github-actions
  2023-06-14  7:24 ` [PR PATCH] [Closed]: " classabbyamp
  2 siblings, 0 replies; 4+ messages in thread
From: github-actions @ 2023-05-09  1:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/40399#issuecomment-1539278201

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Closed]: common/scripts/lint-commits: check commit author github account
  2022-11-09  0:16 [PR PATCH] common/scripts/lint-commits: check commit author github account classabbyamp
  2023-02-07  2:27 ` github-actions
  2023-05-09  1:52 ` github-actions
@ 2023-06-14  7:24 ` classabbyamp
  2 siblings, 0 replies; 4+ messages in thread
From: classabbyamp @ 2023-06-14  7:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

There's a closed pull request on the void-packages repository

common/scripts/lint-commits: check commit author github account
https://github.com/void-linux/void-packages/pull/40399

Description:
Recently, CONTRIBUTING.md added a line about ensuring the email used to commit is associated with a github account. This should be able to lint all commits in a PR to ensure that condition.

While it is using API calls, it should only cost 1 call per CI run.

Will test this soon and refine the implementation.

#### Testing the changes
- I tested the changes in this PR: **NO**



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-14  7:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09  0:16 [PR PATCH] common/scripts/lint-commits: check commit author github account classabbyamp
2023-02-07  2:27 ` github-actions
2023-05-09  1:52 ` github-actions
2023-06-14  7:24 ` [PR PATCH] [Closed]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).