Skip to content
Open
Show file tree
Hide file tree
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
99 changes: 75 additions & 24 deletions .github/scripts/create-pr-body.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
#!/bin/bash

# Script to create PR body
# Arguments: build_time total_time passed failed run_id comparison_section repo commit_message_file
# Arguments: arch build_time total_time passed failed run_id comparison_section repo commit_message_file [build_time_aarch64 total_time_aarch64 passed_aarch64 failed_aarch64]

set -euo pipefail

# Check number of arguments
if [ $# -lt 7 ] || [ $# -gt 8 ]; then
echo "Error: Expected 7 or 8 arguments, got $#" >&2
echo "Usage: $0 <build_time> <total_time> <passed> <failed> <run_id> <comparison_section> <repo> [commit_message_file]" >&2
# Check number of arguments (8-9 for single arch, 13 for multi-arch)
if [ $# -lt 8 ] || ([ $# -gt 9 ] && [ $# -ne 13 ]); then
echo "Error: Expected 8-9 arguments (single arch) or 13 arguments (multi-arch), got $#" >&2
echo "Usage: $0 <arch> <build_time> <total_time> <passed> <failed> <run_id> <comparison_section> <repo> [commit_message_file] [build_time_aarch64 total_time_aarch64 passed_aarch64 failed_aarch64]" >&2
exit 1
Comment on lines +8 to 12
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message validation logic checks if the argument count is either 8-9 or exactly 13, but the comment says "8-9 for single arch" which suggests 8 and 9 are both valid. However, looking at the usage, position 9 is the optional commit_message_file which has a default value. The validation should clarify whether 8 or 9 is the expected count, or document why both are acceptable.

Copilot uses AI. Check for mistakes.
fi

BUILD_TIME="$1"
TOTAL_TIME="$2"
PASSED="$3"
FAILED="$4"
RUN_ID="$5"
COMPARISON_SECTION="$6"
REPO="$7"
COMMIT_MESSAGE_FILE="${8:-/tmp/commit_message.txt}"
ARCH="$1"
BUILD_TIME_X86="$2"
TOTAL_TIME_X86="$3"
PASSED_X86="$4"
FAILED_X86="$5"
Comment on lines +16 to +19
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable names BUILD_TIME_X86, TOTAL_TIME_X86, PASSED_X86, and FAILED_X86 are misleading when the architecture might be aarch64 only (see lines 823-828 where these same variables are used for aarch64 data). Consider using generic names like BUILD_TIME_PRIMARY, TOTAL_TIME_PRIMARY, etc., or renaming them conditionally to avoid confusion when debugging single-architecture aarch64 builds.

Copilot uses AI. Check for mistakes.
RUN_ID="$6"
COMPARISON_SECTION="$7"
REPO="$8"
COMMIT_MESSAGE_FILE="${9:-/tmp/commit_message.txt}"

# Multi-arch parameters (optional)
MULTIARCH=false
if [ $# -eq 13 ]; then
MULTIARCH=true
BUILD_TIME_ARM="${10}"
TOTAL_TIME_ARM="${11}"
PASSED_ARM="${12}"
FAILED_ARM="${13}"
fi

# Validate required arguments are not empty
if [ -z "$BUILD_TIME" ] || [ -z "$TOTAL_TIME" ] || [ -z "$PASSED" ] || [ -z "$FAILED" ] || [ -z "$RUN_ID" ] || [ -z "$COMPARISON_SECTION" ] || [ -z "$REPO" ]; then
if [ -z "$ARCH" ] || [ -z "$BUILD_TIME_X86" ] || [ -z "$TOTAL_TIME_X86" ] || [ -z "$PASSED_X86" ] || [ -z "$FAILED_X86" ] || [ -z "$RUN_ID" ] || [ -z "$COMPARISON_SECTION" ] || [ -z "$REPO" ]; then
echo "Error: One or more required arguments are empty" >&2
echo "Usage: $0 <build_time> <total_time> <passed> <failed> <run_id> <comparison_section> <repo> [commit_message_file]" >&2
echo "Usage: $0 <arch> <build_time> <total_time> <passed> <failed> <run_id> <comparison_section> <repo> [commit_message_file] [build_time_aarch64 total_time_aarch64 passed_aarch64 failed_aarch64]" >&2
exit 1
fi

Expand All @@ -42,8 +53,13 @@ convert_time() {
echo "${minutes}m ${remaining_seconds}s"
}

BUILD_TIME_READABLE=$(convert_time "$BUILD_TIME")
TOTAL_TIME_READABLE=$(convert_time "$TOTAL_TIME")
BUILD_TIME_X86_READABLE=$(convert_time "$BUILD_TIME_X86")
TOTAL_TIME_X86_READABLE=$(convert_time "$TOTAL_TIME_X86")

if [ "$MULTIARCH" = true ]; then
BUILD_TIME_ARM_READABLE=$(convert_time "$BUILD_TIME_ARM")
TOTAL_TIME_ARM_READABLE=$(convert_time "$TOTAL_TIME_ARM")
fi

cat << EOF
## Summary
Expand All @@ -56,23 +72,57 @@ EOF
cat "$COMMIT_MESSAGE_FILE"
echo ""

cat << EOF
if [ "$MULTIARCH" = true ]; then
cat << EOF

## Test Results

### ✅ Build Stage
- Status: Passed
- Build Time: ${BUILD_TIME_READABLE}
- Total Time: ${TOTAL_TIME_READABLE}

| Architecture | Build Time | Total Time |
|--------------|------------|------------|
| x86_64 | ${BUILD_TIME_X86_READABLE} | ${TOTAL_TIME_X86_READABLE} |
| aarch64 | ${BUILD_TIME_ARM_READABLE} | ${TOTAL_TIME_ARM_READABLE} |

- [View build logs](https://github.com/${REPO}/actions/runs/${RUN_ID})

### ✅ Boot Verification
- Status: Passed
- Status: Passed (both architectures)
- [View boot logs](https://github.com/${REPO}/actions/runs/${RUN_ID})

### ✅ Kernel Selftests
- **Passed:** ${PASSED}
- **Failed:** ${FAILED}

| Architecture | Passed | Failed |
|--------------|---------|--------|
| x86_64 | ${PASSED_X86} | ${FAILED_X86} |
| aarch64 | ${PASSED_ARM} | ${FAILED_ARM} |

- [View kselftest logs](https://github.com/${REPO}/actions/runs/${RUN_ID})

${COMPARISON_SECTION}

---
🤖 This PR was automatically generated by GitHub Actions
Run ID: ${RUN_ID}
EOF
else
cat << EOF

## Test Results

### ✅ Build Stage
- Status: Passed (${ARCH})
- Build Time: ${BUILD_TIME_X86_READABLE}
- Total Time: ${TOTAL_TIME_X86_READABLE}
- [View build logs](https://github.com/${REPO}/actions/runs/${RUN_ID})

### ✅ Boot Verification
- Status: Passed (${ARCH})
- [View boot logs](https://github.com/${REPO}/actions/runs/${RUN_ID})

### ✅ Kernel Selftests (${ARCH})
- **Passed:** ${PASSED_X86}
- **Failed:** ${FAILED_X86}
Comment on lines +114 to +125
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the single-arch case, the script uses BUILD_TIME_X86_READABLE and PASSED_X86 variables even when ARCH might be "aarch64" (see workflow lines 823-828). This creates a mismatch between what the architecture actually is and the variable names being used. The script should use conditional variable names or generic names to accurately reflect the architecture being displayed.

Copilot uses AI. Check for mistakes.
- [View kselftest logs](https://github.com/${REPO}/actions/runs/${RUN_ID})

${COMPARISON_SECTION}
Expand All @@ -81,3 +131,4 @@ ${COMPARISON_SECTION}
🤖 This PR was automatically generated by GitHub Actions
Run ID: ${RUN_ID}
EOF
fi
Loading