mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
ci/check-cherry-picks: fail without proper cherry-pick
When cherry-picking without -x or not cherry-picking at all, the check-cherry-picks job would usually remain green. This is annoying to deal with for reviewers, because "all green" still needs attention - have all commits been cherry-picked properly? If a commit was not cherry-picked correctly, either without -x or not at all, because it's a genuine commit to begin with, the reviewers attention is required anyway. Thus we can also let the job fail in this case.
This commit is contained in:
parent
a9b718b796
commit
dfaefc0535
1 changed files with 12 additions and 4 deletions
|
@ -17,7 +17,7 @@ problem=0
|
||||||
# Not everyone calls their remote "origin"
|
# Not everyone calls their remote "origin"
|
||||||
remote="$(git remote -v | grep -i 'NixOS/nixpkgs' | head -n1 | cut -f1 || true)"
|
remote="$(git remote -v | grep -i 'NixOS/nixpkgs' | head -n1 | cut -f1 || true)"
|
||||||
|
|
||||||
commits="$(git rev-list -E -i --grep="cherry.*[0-9a-f]{40}" --reverse "$1..$2")"
|
commits="$(git rev-list --reverse "$1..$2")"
|
||||||
|
|
||||||
while read -r new_commit_sha ; do
|
while read -r new_commit_sha ; do
|
||||||
if [ -z "$new_commit_sha" ] ; then
|
if [ -z "$new_commit_sha" ] ; then
|
||||||
|
@ -34,11 +34,19 @@ while read -r new_commit_sha ; do
|
||||||
original_commit_sha=$(
|
original_commit_sha=$(
|
||||||
git rev-list --max-count=1 --format=format:%B "$new_commit_sha" \
|
git rev-list --max-count=1 --format=format:%B "$new_commit_sha" \
|
||||||
| grep -Ei -m1 "cherry.*[0-9a-f]{40}" \
|
| grep -Ei -m1 "cherry.*[0-9a-f]{40}" \
|
||||||
| grep -Eoi -m1 '[0-9a-f]{40}'
|
| grep -Eoi -m1 '[0-9a-f]{40}' || true
|
||||||
)
|
)
|
||||||
if [ -z "$original_commit_sha" ] ; then
|
if [ -z "$original_commit_sha" ] ; then
|
||||||
echo " ? Couldn't locate original commit hash in message"
|
if [ "$GITHUB_ACTIONS" = 'true' ] ; then
|
||||||
[ "$GITHUB_ACTIONS" = 'true' ] && echo ::endgroup::
|
echo ::endgroup::
|
||||||
|
echo -n "::error ::"
|
||||||
|
else
|
||||||
|
echo -n " ✘ "
|
||||||
|
fi
|
||||||
|
echo "Couldn't locate original commit hash in message"
|
||||||
|
echo "Note this should not necessarily be treated as a hard fail, but a reviewer's attention should" \
|
||||||
|
"be drawn to it and github actions have no way of doing that but to raise a 'failure'"
|
||||||
|
problem=1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue