Skip to content

Commit 8195cb3

Browse files
author
Michael Kaiser
committed
Fix build-pull-request to display errors
1 parent 8a14b0b commit 8195cb3

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.github/workflows/build-pull-request.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
# Create a temporary directory for build logs
4747
mkdir -p /tmp/build_logs
4848
npm install -g eslint > /dev/null
49-
5049
# Function to build a single file
5150
build_file() {
5251
echo "Build File $1"
@@ -63,24 +62,25 @@ jobs:
6362
echo "Build Path $file"
6463
6564
# Run the build script for the current language, passing the project directory and extra path
65+
<<<<<<< HEAD
6666
echo "::group::Building $file"
6767
# Run the build command and capture output to both the log file and stdout
6868
../scripts/build-${language}.sh "$file" 2>&1 | tee "$log_file"
6969
local exit_code=${PIPESTATUS[0]}
7070

7171
if [ $exit_code -eq 0 ]; then
7272
echo "✅ Build succeeded for $file"
73-
73+
7474
# Clean up node_modules and cdk.out for this project immediately after successful build
7575
echo "Cleaning up build artifacts for $(dirname "$file")"
7676
local project_dir=$(dirname "$file")
77-
77+
7878
# Remove node_modules directory if it exists
7979
if [ -d "$project_dir/node_modules" ]; then
8080
echo "Removing $project_dir/node_modules"
8181
rm -rf "$project_dir/node_modules"
8282
fi
83-
83+
8484
# Remove cdk.out directory if it exists
8585
if [ -d "$project_dir/cdk.out" ]; then
8686
echo "Removing $project_dir/cdk.out"
@@ -89,6 +89,20 @@ jobs:
8989
else
9090
echo "❌ Build failed for $file with exit code $exit_code"
9191
echo "::error::Build failed for $file with exit code $exit_code"
92+
=======
93+
echo "::group::$file"
94+
if ../scripts/build-${language}.sh "$file" > "$log_file" 2>&1; then
95+
echo "::endgroup::"
96+
return 0
97+
else
98+
local exit_code=$?
99+
echo "::endgroup::"
100+
echo "::group::Error details for $file"
101+
cat "$log_file"
102+
echo "::endgroup::"
103+
echo "::error::Build failed for $file with exit code $exit_code"
104+
return $exit_code
105+
>>>>>>> 0eba763 (Fix build-pull-request to display errors)
92106
fi
93107
echo "::endgroup::"
94108
return $exit_code

0 commit comments

Comments
 (0)