-
Notifications
You must be signed in to change notification settings - Fork 14
56 lines (47 loc) · 1.79 KB
/
Copy pathupstream-commit-check.yml
File metadata and controls
56 lines (47 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Check Kernel Commits for Upstream Fixes
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
check-upstream-fixes:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Checkout base branch
run: |
git remote add base_repo https://github.com/${{ github.repository }}.git
git fetch base_repo ${{ github.base_ref }}:${{ github.base_ref }}
- name: Download check_kernel_commits.py
run: |
curl -sL \
https://raw.githubusercontent.com/ctrliq/kernel-src-tree-tools/mainline/check_kernel_commits.py \
-o check_kernel_commits.py
chmod +x check_kernel_commits.py
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Run upstream fixes check
id: checkkernel
run: |
python3 check_kernel_commits.py --repo . --pr_branch "${{ github.head_ref }}" --base_branch "${{ github.base_ref }}" --markdown | tee result.txt
# Save non-empty results for PR comment
if grep -q -v "All referenced commits exist upstream and have no Fixes: tags." result.txt; then
echo "has_findings=true" >> $GITHUB_OUTPUT
fi
- name: Comment on PR if issues found
if: steps.checkkernel.outputs.has_findings == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr comment ${{ github.event.pull_request.number }} \
--body "$(cat result.txt)" \
--repo ${{ github.repository }}