Skip to content

Commit a45414f

Browse files
committed
github actions: validate-kernel-commits: Add interdiff
Add steps to look for differences between upsteam commits referenced in PR commit and the upsteam change they are backporting. This is accomplished with a customized version of interdiff with fuzzy diffing and the run_interdiff.py helper script. Since the custom fuzzy diffing changes aren't available in upstream patchutils yet this workflow pulls down and builds the custom version.
1 parent e1033d2 commit a45414f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/validate-kernel-commits.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,41 @@ jobs:
5252
gh pr comment ${{ github.event.pull_request.number }} \
5353
--body "$(cat result.txt)" \
5454
--repo ${{ github.repository }}
55+
56+
- name: Install build dependencies for patchutils
57+
run: |
58+
sudo apt-get update
59+
sudo apt-get install -y build-essential autoconf automake libtool gnulib
60+
61+
- name: Clone and build custom patchutils
62+
run: |
63+
git clone https://github.com/kerneltoast/patchutils
64+
cd patchutils
65+
./bootstrap
66+
./configure
67+
make -j$(nproc)
68+
69+
- name: Download run_interdiff.py
70+
run: |
71+
curl -sL \
72+
https://raw.githubusercontent.com/ctrliq/kernel-src-tree-tools/mainline/run_interdiff.py \
73+
-o run_interdiff.py
74+
chmod +x run_interdiff.py
75+
76+
- name: Run interdiff check
77+
id: interdiff
78+
run: |
79+
python3 run_interdiff.py --repo . --pr_branch "${{ github.head_ref }}" --base_branch "${{ github.base_ref }}" --markdown --interdiff ./patchutils/src/interdiff | tee interdiff_result.txt
80+
# Save non-empty results for PR comment
81+
if grep -q -v "All backported commits match their upstream counterparts." interdiff_result.txt; then
82+
echo "has_differences=true" >> $GITHUB_OUTPUT
83+
fi
84+
85+
- name: Comment on PR if interdiff differences found
86+
if: steps.interdiff.outputs.has_differences == 'true'
87+
env:
88+
GH_TOKEN: ${{ github.token }}
89+
run: |
90+
gh pr comment ${{ github.event.pull_request.number }} \
91+
--body "$(cat interdiff_result.txt)" \
92+
--repo ${{ github.repository }}

0 commit comments

Comments
 (0)