Skip to content

NO_MERGE This is an example PR with an upstream commit checker github action #3

NO_MERGE This is an example PR with an upstream commit checker github action

NO_MERGE This is an example PR with an upstream commit checker github action #3

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:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Checkout base branch
run: |
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
- name: Ensure origin/kernel-mainline exists
run: |
if ! git rev-parse --verify origin/kernel-mainline >/dev/null 2>&1; then
echo "::error::origin/kernel-mainline ref is missing. Please ensure it exists and is up-to-date."
exit 1
fi
- name: Download check_kernel_commits.py
run: |
curl -sL \
https://raw.githubusercontent.com/ctrliq/kernel-src-tree-tools/check_kernel_commits/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 . "${{ github.head_ref }}" "${{ github.base_ref }}" | 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 }}