Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Check every pull request's commits for a sign-off

Țugui Dragoșa27d16d387be
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index 2c2bf4c2..4953aa79 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -15,6 +15,31 @@ concurrency:
cancel-in-progress: true
jobs:
+ # Every commit a pull request brings is signed off by its author, as CONTRIBUTING.md asks.
+ sign-off:
+ if: github.event_name == 'pull_request' && !github.event.repository.private
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
+ with:
+ fetch-depth: 0
+
+ - name: Every commit is signed off by its author
+ env:
+ BASE: ${{ github.event.pull_request.base.sha }}
+ HEAD: ${{ github.event.pull_request.head.sha }}
+ run: |
+ missing=0
+ for commit in $(git rev-list --no-merges "$BASE..$HEAD"); do
+ author=$(git show -s --format='%an <%ae>' "$commit")
+ trailers=$(git show -s --format=%B "$commit" | git interpret-trailers --parse)
+ if ! printf '%s\n' "$trailers" | grep -qxF "Signed-off-by: $author"; then
+ echo "::error::Commit $(git rev-parse --short "$commit") is not signed off by its author."
+ missing=1
+ fi
+ done
+ exit $missing
+
test:
if: github.event_name == 'workflow_dispatch' || !github.event.repository.private
# Peel needs Swift 6.4, which comes with Xcode 27. GitHub offers Xcode 27 only on this preview image, on Apple
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2d0246a7..5d04ca2c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -297,4 +297,5 @@ sold and has no paid edition, so there is no separate commercial license for you
Sign off your commits with `git commit -s`. That is the [Developer Certificate of
Origin](https://developercertificate.org/): you are saying the contribution is yours to give, under the same
license as the rest of Peel. There is no copyright assignment and no agreement to sign, because nothing here will
-ever be relicensed out from under you.
+ever be relicensed out from under you. The Checks workflow checks every commit of a pull request for a sign-off by
+its author.