Skip to content

Commit fc0397c

Browse files
committed
chore: add debug
1 parent 59b4af1 commit fc0397c

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

.github/workflows/pgschema-plan-single.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,48 @@ jobs:
3030
- name: Run pgschema plan
3131
id: plan
3232
run: |
33-
# Run pgschema plan and capture output
34-
PLAN_OUTPUT=$(pgschema plan \
33+
# Debug: Print environment info
34+
echo "::group::Environment Info"
35+
echo "Current directory: $(pwd)"
36+
echo "Schema file path: ${{ github.workspace }}/singlefile/schema.sql"
37+
echo "Checking if schema file exists:"
38+
ls -la "${{ github.workspace }}/singlefile/schema.sql" || echo "Schema file not found!"
39+
echo "Go version: $(go version)"
40+
echo "pgschema location: $(which pgschema)"
41+
echo "::endgroup::"
42+
43+
# Debug: Test pgschema is installed
44+
echo "::group::Testing pgschema installation"
45+
pgschema --version || echo "Failed to run pgschema --version"
46+
echo "::endgroup::"
47+
48+
# Run pgschema plan with timeout and capture output
49+
echo "::group::Running pgschema plan"
50+
set +e # Don't exit on error
51+
PLAN_OUTPUT=$(timeout 60s pgschema plan \
52+
--debug \
3553
--host "${{ secrets.DB_HOST }}" \
3654
--port "${{ secrets.DB_PORT }}" \
3755
--db "${{ secrets.DB_NAME }}" \
3856
--user "${{ secrets.DB_USER }}" \
3957
--file "${{ github.workspace }}/singlefile/schema.sql" \
4058
--format human 2>&1)
59+
EXIT_CODE=$?
60+
set -e # Re-enable exit on error
61+
echo "::endgroup::"
62+
63+
# Check exit code
64+
if [ $EXIT_CODE -eq 124 ]; then
65+
echo "::error::pgschema plan timed out after 60 seconds"
66+
PLAN_OUTPUT="Error: pgschema plan timed out after 60 seconds. This might indicate a connection issue to the database."
67+
elif [ $EXIT_CODE -ne 0 ]; then
68+
echo "::error::pgschema plan failed with exit code $EXIT_CODE"
69+
fi
70+
71+
# Debug: Show raw output
72+
echo "::group::Raw pgschema output"
73+
echo "$PLAN_OUTPUT"
74+
echo "::endgroup::"
4175
4276
# Escape special characters for GitHub Actions
4377
PLAN_OUTPUT="${PLAN_OUTPUT//'%'/'%25'}"

0 commit comments

Comments
 (0)