fix: use jq for webhook JSON encoding to handle multiline commit messages
All checks were successful
Basil CI/CD Pipeline / Code Linting (push) Successful in 57s
Basil CI/CD Pipeline / API Tests (push) Successful in 1m18s
Basil CI/CD Pipeline / Web Tests (push) Successful in 1m7s
Basil CI/CD Pipeline / Shared Package Tests (push) Successful in 53s
Basil CI/CD Pipeline / Security Scanning (push) Successful in 1m8s
Basil CI/CD Pipeline / Build All Packages (push) Successful in 1m32s
Basil CI/CD Pipeline / E2E Tests (push) Has been skipped
Basil CI/CD Pipeline / Build & Push Docker Images (push) Successful in 5m18s
Basil CI/CD Pipeline / Trigger Deployment (push) Successful in 2s
All checks were successful
Basil CI/CD Pipeline / Code Linting (push) Successful in 57s
Basil CI/CD Pipeline / API Tests (push) Successful in 1m18s
Basil CI/CD Pipeline / Web Tests (push) Successful in 1m7s
Basil CI/CD Pipeline / Shared Package Tests (push) Successful in 53s
Basil CI/CD Pipeline / Security Scanning (push) Successful in 1m8s
Basil CI/CD Pipeline / Build All Packages (push) Successful in 1m32s
Basil CI/CD Pipeline / E2E Tests (push) Has been skipped
Basil CI/CD Pipeline / Build & Push Docker Images (push) Successful in 5m18s
Basil CI/CD Pipeline / Trigger Deployment (push) Successful in 2s
The webhook trigger was failing with curl errors: curl: (6) Could not resolve host: requirements curl: (7) Failed to connect to localhost port 9000 The issue: - Commit messages with newlines were breaking shell parsing - Inline JSON string in curl -d was being split by the shell - Multiline commit messages caused curl to misinterpret arguments Solution: - Use jq to construct JSON with proper escaping - Pass GitHub variables as jq --arg parameters - Pipe JSON to curl with -d @- to read from stdin - This safely handles newlines, quotes, and special characters Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -390,15 +390,16 @@ jobs:
|
||||
steps:
|
||||
- name: Trigger webhook
|
||||
run: |
|
||||
jq -n \
|
||||
--arg branch "main" \
|
||||
--arg commit "${{ github.sha }}" \
|
||||
--arg message "${{ github.event.head_commit.message }}" \
|
||||
--arg tag "${{ needs.docker-build-and-push.outputs.image_tag }}" \
|
||||
'{branch: $branch, commit: $commit, message: $message, tag: $tag}' | \
|
||||
curl -X POST ${{ secrets.WEBHOOK_URL }} \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Webhook-Secret: ${{ secrets.WEBHOOK_SECRET }}" \
|
||||
-d '{
|
||||
"branch": "main",
|
||||
"commit": "${{ github.sha }}",
|
||||
"message": "${{ github.event.head_commit.message }}",
|
||||
"tag": "${{ needs.docker-build-and-push.outputs.image_tag }}"
|
||||
}' || echo "Webhook call failed, but continuing..."
|
||||
-d @- || echo "Webhook call failed, but continuing..."
|
||||
|
||||
- name: Deployment triggered
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user