Skip to content

Commit 0eba763

Browse files
author
Michael Kaiser
committed
Fix build-pull-request to display errors
1 parent 91a42f5 commit 0eba763

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ jobs:
4343
- name: Build changed files
4444
if: steps.changed-files.outputs.any_changed == 'true'
4545
run: |
46+
# Create a temporary directory for build logs
47+
mkdir -p /tmp/build_logs
48+
4649
# Function to build a single file
4750
build_file() {
4851
echo "Build File $1"
4952
local file="$1"
53+
local log_file="/tmp/build_logs/$(basename "$file" | sed 's/\//_/g').log"
5054
IFS="/" read -ra path_parts <<< "$file"
5155
language=${path_parts[0]}
5256
@@ -59,12 +63,17 @@ jobs:
5963
6064
# Run the build script for the current language, passing the project directory and extra path
6165
echo "::group::$file"
62-
if ../scripts/build-${language}.sh "$file"; then
66+
if ../scripts/build-${language}.sh "$file" > "$log_file" 2>&1; then
6367
echo "::endgroup::"
68+
return 0
6469
else
70+
local exit_code=$?
71+
echo "::endgroup::"
72+
echo "::group::Error details for $file"
73+
cat "$log_file"
6574
echo "::endgroup::"
66-
echo "::error::Build failed for $file"
67-
return 1
75+
echo "::error::Build failed for $file with exit code $exit_code"
76+
return $exit_code
6877
fi
6978
}
7079

0 commit comments

Comments
 (0)