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
@@ -172,6 +172,39 @@ jobs:
172172 path : build.log
173173 if-no-files-found : warn
174174
175+ - name : Fetch previous PR kselftest results
176+ if : success()
177+ run : |
178+ cd kernel-src-tree
179+
180+ # Extract the major.minor version for matching (e.g., "6.12" from "6.12.y")
181+ CLK_VERSION=$(echo "$STABLE_BASE_VERSION" | grep -oP '^\d+\.\d+')
182+ echo "Looking for previous [CIQ ${CLK_VERSION}] PR..."
183+
184+ # Find the most recent merged PR to the same base branch with matching CIQ version
185+ PREVIOUS_PR=$(gh pr list \
186+ --repo ${{ github.repository }} \
187+ --base ${CLK_NEXT_BRANCH} \
188+ --state merged \
189+ --limit 10 \
190+ --json number,title,body,mergedAt \
191+ --jq "map(select(.title | contains(\"[CIQ ${CLK_VERSION}]\"))) | sort_by(.mergedAt) | reverse | .[0]")
192+
193+ if [ -n "$PREVIOUS_PR" ] && [ "$PREVIOUS_PR" != "null" ]; then
194+ # Extract the test count from the previous PR body
195+ PREVIOUS_PR_BODY=$(echo "$PREVIOUS_PR" | jq -r '.body')
196+ PREVIOUS_OK_TESTS=$(echo "$PREVIOUS_PR_BODY" | grep -oP 'Selftests passed:\s+\*\*\K[0-9]+' || echo "unknown")
197+ PREVIOUS_PR_NUMBER=$(echo "$PREVIOUS_PR" | jq -r '.number')
198+
199+ echo "Found previous PR #${PREVIOUS_PR_NUMBER} with ${PREVIOUS_OK_TESTS} passing tests"
200+ echo "$PREVIOUS_OK_TESTS" > ../previous_ok_tests.txt
201+ echo "$PREVIOUS_PR_NUMBER" > ../previous_pr_number.txt
202+ else
203+ echo "No previous [CIQ ${CLK_VERSION}] PR found"
204+ echo "unknown" > ../previous_ok_tests.txt
205+ echo "N/A" > ../previous_pr_number.txt
206+ fi
207+
175208 - name : Create Pull Request
176209 if : success()
177210 run : |
@@ -180,6 +213,8 @@ jobs:
180213 STABLE_VERSION=$(cat ../stable_version.txt)
181214 OK_TESTS=$(cat ../ok_tests.txt)
182215 CONFIG_CHANGES=$(cat ../config_changes.txt)
216+ PREVIOUS_OK_TESTS=$(cat ../previous_ok_tests.txt)
217+ PREVIOUS_PR_NUMBER=$(cat ../previous_pr_number.txt)
183218
184219 # Extract abbreviated build log (first 20 and last 20 lines)
185220 BUILD_LOG_SUMMARY=$(egrep -B 5 -A 5 "\[TIMER\]|^Starting Build" ../build.log)
@@ -190,6 +225,13 @@ jobs:
190225 SELFTEST_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
191226 BUILD_LOG_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
192227
228+ # Build previous test results line if available
229+ if [ "$PREVIOUS_OK_TESTS" != "unknown" ] && [ "$PREVIOUS_PR_NUMBER" != "N/A" ]; then
230+ PREVIOUS_TEST_LINE="Previous: ${PREVIOUS_OK_TESTS} tests ([PR #${PREVIOUS_PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PREVIOUS_PR_NUMBER}))"
231+ else
232+ PREVIOUS_TEST_LINE=""
233+ fi
234+
193235 # Create PR body
194236 cat > /tmp/pr_body.md <<EOF
195237 ## Automated Rebase to v${STABLE_VERSION}
@@ -206,6 +248,7 @@ jobs:
206248
207249 ### Testing
208250 Selftests passed: **${OK_TESTS}** tests
251+ ${PREVIOUS_TEST_LINE}
209252
210253 ### Artifacts
211254 - [Build Log](${BUILD_LOG_ARTIFACT_URL})
0 commit comments