From 4c3d71f135615982aac9ac07c97b26e0205dda60 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Fri, 12 Dec 2025 11:06:43 -0500 Subject: [PATCH 1/6] failing test --- .github/workflows/ci.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85d67ea..dcda109 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,11 @@ jobs: license: ${{ secrets.CONNECT_LICENSE }} # If this were not quoted in bash -c before running, $CONNECT_API_KEY # would evaluate before with-connect defines it. - command: 'curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content' + command: | + set -euo pipefail + RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) + echo "$RESPONSE" | jq -e '.results' > /dev/null + echo "✓ Single line test passed - got valid JSON response with results array" - name: Test with-connect action (multiline, different quoting) uses: ./ @@ -44,9 +48,15 @@ jobs: version: 2024.08.0 license: ${{ secrets.CONNECT_LICENSE }} command: | - echo "Testing multiline command support" - curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content - echo 'Multiline test passed' + set -euo pipefail + echo "Testing multiline command with various quote types" + RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) + echo "$RESPONSE" | jq -e '.results' > /dev/null + # Test that single quotes work in commands + TEST_STRING='This contains single quotes' + echo "TEST_STRING value: $TEST_STRING" + [ "$TEST_STRING" = "This contains single quotes" ] || exit 1 + echo "✓ Multiline test passed - variables, single quotes, and double quotes all work" test-cli: runs-on: ubuntu-latest @@ -65,4 +75,9 @@ jobs: - name: Test with-connect CLI run: | with-connect --version 2024.08.0 -- \ - bash -c 'curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content' + bash -c ' + set -euo pipefail + RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) + echo "$RESPONSE" | jq -e ".results" > /dev/null + echo "✓ CLI test passed - got valid JSON response" + ' From 09150ab914dc54920a5c294760bc050e9753a7c5 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Fri, 12 Dec 2025 11:13:33 -0500 Subject: [PATCH 2/6] the fix --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 8c1103f..98614b9 100644 --- a/action.yml +++ b/action.yml @@ -57,4 +57,6 @@ runs: fi done <<< "${{ inputs.env }}" fi - with-connect $ARGS -- bash -c "$1" _ "${{ inputs.command }}" + with-connect $ARGS -- bash <<'SCRIPT' + ${{ inputs.command }} + SCRIPT From 4647d264493f65538a7189d342a4943471ec3962 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Fri, 12 Dec 2025 11:20:18 -0500 Subject: [PATCH 3/6] Fix test --- .github/workflows/ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dcda109..acf3ef4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,13 +34,9 @@ jobs: with: version: 2024.08.0 license: ${{ secrets.CONNECT_LICENSE }} - # If this were not quoted in bash -c before running, $CONNECT_API_KEY + # If this were not quoted before running, $CONNECT_API_KEY # would evaluate before with-connect defines it. - command: | - set -euo pipefail - RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) - echo "$RESPONSE" | jq -e '.results' > /dev/null - echo "✓ Single line test passed - got valid JSON response with results array" + command: 'curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content' - name: Test with-connect action (multiline, different quoting) uses: ./ @@ -51,7 +47,8 @@ jobs: set -euo pipefail echo "Testing multiline command with various quote types" RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) - echo "$RESPONSE" | jq -e '.results' > /dev/null + # The response should be an empty JSON array since no content has been deployed + [ "RESPONSE" = "[]" ] || exit 1 # Test that single quotes work in commands TEST_STRING='This contains single quotes' echo "TEST_STRING value: $TEST_STRING" From 1aea7d183d7bd73ed78e9ecc8480cf86fbc5f1d5 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Fri, 12 Dec 2025 11:20:52 -0500 Subject: [PATCH 4/6] one more --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acf3ef4..ed8b4b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,7 @@ jobs: bash -c ' set -euo pipefail RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) - echo "$RESPONSE" | jq -e ".results" > /dev/null + # The response should be an empty JSON array since no content has been deployed + [ "RESPONSE" = "[]" ] || exit 1 echo "✓ CLI test passed - got valid JSON response" ' From 1f41d5276788ee996087d8e85c25f324dc6957f5 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Fri, 12 Dec 2025 11:24:10 -0500 Subject: [PATCH 5/6] verbosity --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed8b4b1..cad9dd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,7 @@ jobs: echo "Testing multiline command with various quote types" RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) # The response should be an empty JSON array since no content has been deployed + echo "Response: $RESPONSE" [ "RESPONSE" = "[]" ] || exit 1 # Test that single quotes work in commands TEST_STRING='This contains single quotes' @@ -76,6 +77,7 @@ jobs: set -euo pipefail RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) # The response should be an empty JSON array since no content has been deployed + echo "Response: $RESPONSE" [ "RESPONSE" = "[]" ] || exit 1 echo "✓ CLI test passed - got valid JSON response" ' From 13a13a3afb5a2d4f5dec2b0fb3467f02bf358789 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Fri, 12 Dec 2025 11:31:50 -0500 Subject: [PATCH 6/6] :facepalm: --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cad9dd8..fa1a9e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) # The response should be an empty JSON array since no content has been deployed echo "Response: $RESPONSE" - [ "RESPONSE" = "[]" ] || exit 1 + [ "$RESPONSE" = "[]" ] || exit 1 # Test that single quotes work in commands TEST_STRING='This contains single quotes' echo "TEST_STRING value: $TEST_STRING" @@ -78,6 +78,6 @@ jobs: RESPONSE=$(curl -f -H "Authorization: Key $CONNECT_API_KEY" $CONNECT_SERVER/__api__/v1/content) # The response should be an empty JSON array since no content has been deployed echo "Response: $RESPONSE" - [ "RESPONSE" = "[]" ] || exit 1 + [ "$RESPONSE" = "[]" ] || exit 1 echo "✓ CLI test passed - got valid JSON response" '