forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# XXX: checklist | ||
name: Contribute | ||
|
||
on: | ||
pull_request: | ||
types: [ opened, reopened, edited, synchronize ] | ||
|
||
jobs: | ||
checklist: | ||
name: Check List | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v7 | ||
with: | ||
# A Javascript function | ||
script: | | ||
const commits = await github.paginate(github.rest.pulls.listCommits, { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number | ||
}); | ||
const comments = await github.paginate(github.rest.issues.listComments, { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number | ||
}); | ||
let checklist = []; | ||
for (const commit of commits) { | ||
const postfix = " on " + commit.sha; | ||
const sob_lines = commit.commit.message.match("/^\s*signed-off-by:./i"); | ||
if (sob_lines == null && !commit.commit.author.email.endsWith("FreeBSD.org")) | ||
checklist.push("Missing Signed-off-by: lines" + postfix); | ||
else { | ||
for (const line in sob_lines) { | ||
if (!line.startsWith("Signed-off-by:")) | ||
checklist.push("Expected \"Signed-off-by\", got " + line + postfix); | ||
else if (!line.endsWith(" ")) | ||
checklist.push("Space required after Signed-off-by" + postfix); | ||
} | ||
} | ||
if (commit.commit.author.email.includes("noreply")) | ||
checklist.push("Bad email!" + postfix); | ||
} | ||
console.log(checklist); | ||
for (const c in checklist) | ||
console.log(c); |