about summary refs log tree commit diff
path: root/.github/workflows/check-cherry-picks.yml
diff options
context:
space:
mode:
authorRobert Scott <code@humanleg.org.uk>2022-05-07 12:54:51 +0100
committerRobert Scott <code@humanleg.org.uk>2024-04-01 16:10:13 +0100
commitfbad66daa54da694be13df7b24b18b7bad843d56 (patch)
tree66cdfefa9e871e751a233928c902f6b93e28ff14 /.github/workflows/check-cherry-picks.yml
parent354e1366a78c6d178bdd636ea8e9b8628a015e12 (diff)
add "Check cherry-picks" github action
the intention being to catch commits which declare themselves as
cherry-picks, but either:

 - don't refer to a commit in the master or staging branches
 - are significantly altered from their original commit

determining the latter is not an exact science, but the heuristic of
looking for differences in only the added or removed lines seems to
work quite well. still, this should be considered an assistant
for reviewers rather than a hard failure. unfortunately github
workflows don't have a way of raising a gentle warning instead of a
failure.

the formatting of the output also leaves something to be desired due
to the limitations of github actions' "group" commands.
Diffstat (limited to '.github/workflows/check-cherry-picks.yml')
-rw-r--r--.github/workflows/check-cherry-picks.yml24
1 files changed, 24 insertions, 0 deletions
diff --git a/.github/workflows/check-cherry-picks.yml b/.github/workflows/check-cherry-picks.yml
new file mode 100644
index 0000000000000..9e7f6e277e993
--- /dev/null
+++ b/.github/workflows/check-cherry-picks.yml
@@ -0,0 +1,24 @@
+name: "Check cherry-picks"
+on:
+  pull_request_target:
+    branches:
+     - 'release-*'
+     - 'staging-*'
+
+permissions: {}
+
+jobs:
+  check:
+    runs-on: ubuntu-latest
+    if: github.repository_owner == 'NixOS'
+    steps:
+    - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+      with:
+        fetch-depth: 0
+        filter: blob:none
+    - name: Check cherry-picks
+      env:
+        BASE_SHA: ${{ github.event.pull_request.base.sha }}
+        HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+      run: |
+        ./maintainers/scripts/check-cherry-picks.sh "$BASE_SHA" "$HEAD_SHA"