Fix shell quoting in CI webhook notification step
All checks were successful
CI/CD Pipeline - Apartment API / Scan Dependencies (pull_request) Successful in 12s
CI/CD Pipeline - Apartment API / Run Linting (pull_request) Successful in 9m37s
CI/CD Pipeline - Apartment API / Run Tests (pull_request) Successful in 9m51s
CI/CD Pipeline - Apartment API / Send Webhook Notification (pull_request) Successful in 2s
CI/CD Pipeline - Apartment API / Build & Push Image (pull_request) Has been skipped
CI/CD Pipeline - Apartment API / Deploy to Production (pull_request) Has been skipped
All checks were successful
CI/CD Pipeline - Apartment API / Scan Dependencies (pull_request) Successful in 12s
CI/CD Pipeline - Apartment API / Run Linting (pull_request) Successful in 9m37s
CI/CD Pipeline - Apartment API / Run Tests (pull_request) Successful in 9m51s
CI/CD Pipeline - Apartment API / Send Webhook Notification (pull_request) Successful in 2s
CI/CD Pipeline - Apartment API / Build & Push Image (pull_request) Has been skipped
CI/CD Pipeline - Apartment API / Deploy to Production (pull_request) Has been skipped
Move all GitHub Actions expressions into env: block instead of interpolating directly into shell script. Test output containing single quotes was breaking the shell parser, causing EOF errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
44
.github/workflows/deploy.yml
vendored
44
.github/workflows/deploy.yml
vendored
@ -109,11 +109,23 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Send results to n8n webhook
|
- name: Send results to n8n webhook
|
||||||
|
env:
|
||||||
|
LINT_STATUS: ${{ needs.lint.result }}
|
||||||
|
TEST_STATUS: ${{ needs.test.result }}
|
||||||
|
RAW_LINT_OUTPUT: ${{ needs.lint.outputs.output }}
|
||||||
|
RAW_TEST_OUTPUT: ${{ needs.test.outputs.output }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
GH_BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||||
|
GH_SHA: ${{ github.sha }}
|
||||||
|
GH_COMMIT_MSG: ${{ github.event.head_commit.message || github.event.pull_request.title || 'N/A' }}
|
||||||
|
GH_ACTOR: ${{ github.actor }}
|
||||||
|
GH_EVENT: ${{ github.event_name }}
|
||||||
|
GH_PR_NUMBER: ${{ github.event.pull_request.number || '' }}
|
||||||
|
GH_RUN_ID: ${{ github.run_id }}
|
||||||
|
GH_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
WEBHOOK_URL: ${{ secrets.N8N_WEBHOOK_URL }}
|
||||||
run: |
|
run: |
|
||||||
# Determine overall status
|
# Determine overall status
|
||||||
LINT_STATUS="${{ needs.lint.result }}"
|
|
||||||
TEST_STATUS="${{ needs.test.result }}"
|
|
||||||
|
|
||||||
if [ "$LINT_STATUS" = "success" ] && [ "$TEST_STATUS" = "success" ]; then
|
if [ "$LINT_STATUS" = "success" ] && [ "$TEST_STATUS" = "success" ]; then
|
||||||
OVERALL_STATUS="success"
|
OVERALL_STATUS="success"
|
||||||
else
|
else
|
||||||
@ -121,21 +133,21 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Truncate outputs if too long (max 10000 chars each)
|
# Truncate outputs if too long (max 10000 chars each)
|
||||||
LINT_OUTPUT=$(echo '${{ needs.lint.outputs.output }}' | head -c 10000)
|
LINT_OUTPUT=$(echo "$RAW_LINT_OUTPUT" | head -c 10000)
|
||||||
TEST_OUTPUT=$(echo '${{ needs.test.outputs.output }}' | head -c 10000)
|
TEST_OUTPUT=$(echo "$RAW_TEST_OUTPUT" | head -c 10000)
|
||||||
|
|
||||||
# Build JSON payload
|
# Build JSON payload
|
||||||
PAYLOAD=$(jq -n \
|
PAYLOAD=$(jq -n \
|
||||||
--arg repo "${{ github.repository }}" \
|
--arg repo "$GH_REPO" \
|
||||||
--arg branch "${{ github.head_ref || github.ref_name }}" \
|
--arg branch "$GH_BRANCH" \
|
||||||
--arg commit "${{ github.sha }}" \
|
--arg commit "$GH_SHA" \
|
||||||
--arg commit_short "$(echo '${{ github.sha }}' | cut -c1-7)" \
|
--arg commit_short "${GH_SHA:0:7}" \
|
||||||
--arg commit_message "${{ github.event.head_commit.message || github.event.pull_request.title || 'N/A' }}" \
|
--arg commit_message "$GH_COMMIT_MSG" \
|
||||||
--arg author "${{ github.actor }}" \
|
--arg author "$GH_ACTOR" \
|
||||||
--arg event "${{ github.event_name }}" \
|
--arg event "$GH_EVENT" \
|
||||||
--arg pr_number "${{ github.event.pull_request.number || '' }}" \
|
--arg pr_number "$GH_PR_NUMBER" \
|
||||||
--arg run_id "${{ github.run_id }}" \
|
--arg run_id "$GH_RUN_ID" \
|
||||||
--arg run_url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
|
--arg run_url "$GH_RUN_URL" \
|
||||||
--arg overall_status "$OVERALL_STATUS" \
|
--arg overall_status "$OVERALL_STATUS" \
|
||||||
--arg lint_status "$LINT_STATUS" \
|
--arg lint_status "$LINT_STATUS" \
|
||||||
--arg lint_output "$LINT_OUTPUT" \
|
--arg lint_output "$LINT_OUTPUT" \
|
||||||
@ -175,7 +187,7 @@ jobs:
|
|||||||
curl -X POST \
|
curl -X POST \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$PAYLOAD" \
|
-d "$PAYLOAD" \
|
||||||
"${{ secrets.N8N_WEBHOOK_URL }}" \
|
"$WEBHOOK_URL" \
|
||||||
--fail --silent --show-error
|
--fail --silent --show-error
|
||||||
|
|
||||||
- name: Fail if lint or tests failed
|
- name: Fail if lint or tests failed
|
||||||
|
|||||||
Reference in New Issue
Block a user