3434 run : |
3535 dnf install epel-release -y
3636 dnf groupinstall 'Development Tools' -y
37- dnf install --enablerepo=crb bc dwarves elfutils-libelf-devel grubby grub2-tools iproute kernel-devel openssl-devel qemu-kvm sudo virtme-ng -y
37+ dnf install --enablerepo=crb bc dwarves elfutils-libelf-devel grubby grub2-tools iproute jq kernel-devel openssl-devel qemu-kvm sudo virtme-ng -y
3838
3939 # so root can call sudo without complaint
4040 echo "root ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
@@ -175,6 +175,39 @@ jobs:
175175 path : build.log
176176 if-no-files-found : warn
177177
178+ - name : Fetch previous PR kselftest results
179+ if : success()
180+ run : |
181+ cd kernel-src-tree
182+
183+ # Extract the major.minor version for matching (e.g., "6.12" from "6.12.y")
184+ CLK_VERSION=$(echo "$STABLE_BASE_VERSION" | grep -oP '^\d+\.\d+')
185+ echo "Looking for previous [CIQ ${CLK_VERSION}] PR..."
186+
187+ # Find the most recent merged PR to the same base branch with matching CIQ version
188+ PREVIOUS_PR=$(gh pr list \
189+ --repo ${{ github.repository }} \
190+ --base ${CLK_NEXT_BRANCH} \
191+ --state merged \
192+ --limit 10 \
193+ --json number,title,body,mergedAt \
194+ --jq "map(select(.title | contains(\"[CIQ ${CLK_VERSION}]\"))) | sort_by(.mergedAt) | reverse | .[0]")
195+
196+ if [ -n "$PREVIOUS_PR" ] && [ "$PREVIOUS_PR" != "null" ]; then
197+ # Extract the test count from the previous PR body
198+ PREVIOUS_PR_BODY=$(echo "$PREVIOUS_PR" | jq -r '.body')
199+ PREVIOUS_OK_TESTS=$(echo "$PREVIOUS_PR_BODY" | grep -oP 'Selftests passed:\s+\*\*\K[0-9]+' || echo "unknown")
200+ PREVIOUS_PR_NUMBER=$(echo "$PREVIOUS_PR" | jq -r '.number')
201+
202+ echo "Found previous PR #${PREVIOUS_PR_NUMBER} with ${PREVIOUS_OK_TESTS} passing tests"
203+ echo "$PREVIOUS_OK_TESTS" > ../previous_ok_tests.txt
204+ echo "$PREVIOUS_PR_NUMBER" > ../previous_pr_number.txt
205+ else
206+ echo "No previous [CIQ ${CLK_VERSION}] PR found"
207+ echo "unknown" > ../previous_ok_tests.txt
208+ echo "N/A" > ../previous_pr_number.txt
209+ fi
210+
178211 - name : Create Pull Request
179212 if : success()
180213 run : |
@@ -183,6 +216,8 @@ jobs:
183216 STABLE_VERSION=$(cat ../stable_version.txt)
184217 OK_TESTS=$(cat ../ok_tests.txt)
185218 CONFIG_CHANGES=$(cat ../config_changes.txt)
219+ PREVIOUS_OK_TESTS=$(cat ../previous_ok_tests.txt)
220+ PREVIOUS_PR_NUMBER=$(cat ../previous_pr_number.txt)
186221
187222 # Extract abbreviated build log (first 20 and last 20 lines)
188223 #BUILD_LOG_SUMMARY=$(head -20 ../build.log && echo "" && echo "[snip]" && echo "" && tail -20 ../build.log)
@@ -194,6 +229,13 @@ jobs:
194229 SELFTEST_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
195230 BUILD_LOG_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
196231
232+ # Build previous test results line if available
233+ if [ "$PREVIOUS_OK_TESTS" != "unknown" ] && [ "$PREVIOUS_PR_NUMBER" != "N/A" ]; then
234+ PREVIOUS_TEST_LINE="Previous: ${PREVIOUS_OK_TESTS} tests ([PR #${PREVIOUS_PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PREVIOUS_PR_NUMBER}))"
235+ else
236+ PREVIOUS_TEST_LINE=""
237+ fi
238+
197239 # Create PR body
198240 cat > /tmp/pr_body.md <<EOF
199241 ## Automated Rebase to v${STABLE_VERSION}
@@ -210,6 +252,7 @@ jobs:
210252
211253 ### Testing
212254 Selftests passed: **${OK_TESTS}** tests
255+ ${PREVIOUS_TEST_LINE}
213256
214257 ### Artifacts
215258 - [Build Log](${BUILD_LOG_ARTIFACT_URL})
0 commit comments