Skip to content

Commit 53a82b2

Browse files
Add PR body generation script
Script to generate detailed PR descriptions with kselftest results. Signed-off-by: Shreeya Patel <[email protected]>
1 parent 066f7ce commit 53a82b2

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/scripts/create-pr-body.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
# Script to create PR body
4+
# Arguments: build_time total_time passed failed run_id comparison_section
5+
6+
BUILD_TIME="$1"
7+
TOTAL_TIME="$2"
8+
PASSED="$3"
9+
FAILED="$4"
10+
RUN_ID="$5"
11+
COMPARISON_SECTION="$6"
12+
REPO="$7"
13+
14+
# Convert seconds to minutes for better readability
15+
convert_time() {
16+
local seconds="${1%s}" # Remove 's' suffix if present
17+
local minutes=$((seconds / 60))
18+
local remaining_seconds=$((seconds % 60))
19+
echo "${minutes}m ${remaining_seconds}s"
20+
}
21+
22+
BUILD_TIME_READABLE=$(convert_time "$BUILD_TIME")
23+
TOTAL_TIME_READABLE=$(convert_time "$TOTAL_TIME")
24+
25+
cat << EOF
26+
## Summary
27+
This PR has been automatically created after successful completion of all CI stages.
28+
29+
## Commit Message(s)
30+
\`\`\`
31+
EOF
32+
33+
cat /tmp/commit_message.txt
34+
35+
cat << EOF
36+
\`\`\`
37+
38+
## Test Results
39+
40+
### ✅ Build Stage
41+
- Status: Passed
42+
- Build Time: ${BUILD_TIME_READABLE}
43+
- Total Time: ${TOTAL_TIME_READABLE}
44+
- [View build logs](https://github.com/${REPO}/actions/runs/${RUN_ID})
45+
46+
### ✅ Boot Verification
47+
- Status: Passed
48+
- [View boot logs](https://github.com/${REPO}/actions/runs/${RUN_ID})
49+
50+
### ✅ Kernel Selftests
51+
- **Passed:** ${PASSED}
52+
- **Failed:** ${FAILED}
53+
- [View kselftest logs](https://github.com/${REPO}/actions/runs/${RUN_ID})
54+
55+
${COMPARISON_SECTION}
56+
57+
---
58+
🤖 This PR was automatically generated by GitHub Actions
59+
Run ID: ${RUN_ID}
60+
EOF

0 commit comments

Comments
 (0)