Skip to content

[fips-8] github actions: Add upstream commit checker #479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/upstream-commit-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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: Download check_kernel_commits.py
run: |
curl -sL \
https://github.com/raw/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 }}
Loading