Workflow names now match their file stems, so the Actions list and the files read the same; generate-deps-relation-r1.yml becomes deps-table.yml after the branch it maintains. Steps are lowercase and verb-first, every step is named, and the autobump-rb checkout has one name everywhere. Also use 4-space step indentation, fromJSON, bare if: expressions, github.actor for every ghcr login, uppercase env names, and the GITHUB_REPOSITORY and GITHUB_REPOSITORY_OWNER variables the runner already sets instead of REPO and OWNER copies. No behaviour changes. Signed-off-by: Zakk <zakk@gentoozh.org>
14 lines
822 B
Bash
Executable File
14 lines
822 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# usage: commit-rules.sh <pull request number>
|
|
# prints the commits of the pull request that break the commit rules in CONTRIBUTING.en.md
|
|
set -euo pipefail
|
|
# shellcheck disable=SC2016 # jq, not shell, expands these
|
|
gh api "repos/$GITHUB_REPOSITORY/pulls/${1:?pull request number}/commits?per_page=100" --paginate --jq '
|
|
.[] | (.commit.message | split("\n")[0]) as $s
|
|
| if (.parents | length) > 1 then ["It is a merge commit"]
|
|
else [ if ($s | test("^(Revert \"|[^\\s:][^:]*: \\S)")) then empty else "The subject does not start with what it changes" end,
|
|
if (.commit.message | test("(?m)^Signed-off-by: \\S")) then empty else "It has no `Signed-off-by:` line" end ]
|
|
end as $why
|
|
| select($why | length > 0)
|
|
| "- `\(.sha[0:12])` \($s)\n" + ($why | map(" - " + .) | join("\n"))'
|