Skip to content

Commit 94e15ef

Browse files
FIX: Fixed the large file handling issue in the Github actions (#106)
* REFACTOR: Refactored the file structure to be sync in the Postman * FIX: Fix the branch name to run the actions on * FIX: Reformatted the filename in action * FIX: Fix the large file sending issue in github actions
1 parent 2c3981b commit 94e15ef

File tree

8 files changed

+112
-40
lines changed

8 files changed

+112
-40
lines changed

.github/workflows/sync-admin.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ jobs:
2424
SCHEMA_ID=${{vars.ADMIN_DEFINITION_ID}}
2525
FILE_PATH="index.json"
2626
27-
CONTENT=$(jq -Rs . < ${SWAGGER_FILE})
27+
# Read the Swagger file content and escape it properly for JSON
28+
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
29+
30+
# Create the JSON payload with the file content as a string
31+
JSON_PAYLOAD="{\"content\": $CONTENT}"
32+
33+
# Write the JSON payload to a temporary file
34+
echo "$JSON_PAYLOAD" > payload.json
35+
36+
# Use curl with --data-binary to handle large file content
2837
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
29-
--header "Accept: application/vnd.api.v10+json" \
30-
--header "Content-Type: application/json" \
31-
--header "X-Api-Key: $POSTMAN_API_KEY" \
32-
--data "{\"content\": ${CONTENT}}"
38+
--header "Accept: application/vnd.api.v10+json" \
39+
--header "Content-Type: application/json" \
40+
--header "X-Api-Key: $POSTMAN_API_KEY" \
41+
--data-binary @payload.json

.github/workflows/sync-click.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ jobs:
2424
SCHEMA_ID=${{vars.DEFINITION_ID}}
2525
FILE_PATH="click/schema.json"
2626
27-
CONTENT=$(jq -Rs . < ${SWAGGER_FILE})
27+
# Read the Swagger file content and escape it properly for JSON
28+
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
29+
30+
# Create the JSON payload with the file content as a string
31+
JSON_PAYLOAD="{\"content\": $CONTENT}"
32+
33+
# Write the JSON payload to a temporary file
34+
echo "$JSON_PAYLOAD" > payload.json
35+
36+
# Use curl with --data-binary to handle large file content
2837
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
29-
--header "Accept: application/vnd.api.v10+json" \
30-
--header "Content-Type: application/json" \
31-
--header "X-Api-Key: $POSTMAN_API_KEY" \
32-
--data "{\"content\": ${CONTENT}}"
38+
--header "Accept: application/vnd.api.v10+json" \
39+
--header "Content-Type: application/json" \
40+
--header "X-Api-Key: $POSTMAN_API_KEY" \
41+
--data-binary @payload.json

.github/workflows/sync-connect.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ jobs:
2424
SCHEMA_ID=${{vars.CONNECT_DEFINITION_ID}}
2525
FILE_PATH="index.json"
2626
27-
CONTENT=$(jq -Rs . < ${SWAGGER_FILE})
27+
# Read the Swagger file content and escape it properly for JSON
28+
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
29+
30+
# Create the JSON payload with the file content as a string
31+
JSON_PAYLOAD="{\"content\": $CONTENT}"
32+
33+
# Write the JSON payload to a temporary file
34+
echo "$JSON_PAYLOAD" > payload.json
35+
36+
# Use curl with --data-binary to handle large file content
2837
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
29-
--header "Accept: application/vnd.api.v10+json" \
30-
--header "Content-Type: application/json" \
31-
--header "X-Api-Key: $POSTMAN_API_KEY" \
32-
--data "{\"content\": ${CONTENT}}"
38+
--header "Accept: application/vnd.api.v10+json" \
39+
--header "Content-Type: application/json" \
40+
--header "X-Api-Key: $POSTMAN_API_KEY" \
41+
--data-binary @payload.json

.github/workflows/sync-esign.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ jobs:
2424
SCHEMA_ID=${{vars.ESIGN_DEFINITION_ID}}
2525
FILE_PATH="index.json"
2626
27-
CONTENT=$(jq -Rs . < ${SWAGGER_FILE})
27+
# Read the Swagger file content and escape it properly for JSON
28+
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
29+
30+
# Create the JSON payload with the file content as a string
31+
JSON_PAYLOAD="{\"content\": $CONTENT}"
32+
33+
# Write the JSON payload to a temporary file
34+
echo "$JSON_PAYLOAD" > payload.json
35+
36+
# Use curl with --data-binary to handle large file content
2837
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
29-
--header "Accept: application/vnd.api.v10+json" \
30-
--header "Content-Type: application/json" \
31-
--header "X-Api-Key: $POSTMAN_API_KEY" \
32-
--data "{\"content\": ${CONTENT}}"
38+
--header "Accept: application/vnd.api.v10+json" \
39+
--header "Content-Type: application/json" \
40+
--header "X-Api-Key: $POSTMAN_API_KEY" \
41+
--data-binary @payload.json

.github/workflows/sync-maestro.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ jobs:
2424
SCHEMA_ID=${{vars.MAESTRO_DEFINITION_ID}}
2525
FILE_PATH="index.json"
2626
27-
CONTENT=$(jq -Rs . < ${SWAGGER_FILE})
27+
# Read the Swagger file content and escape it properly for JSON
28+
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
29+
30+
# Create the JSON payload with the file content as a string
31+
JSON_PAYLOAD="{\"content\": $CONTENT}"
32+
33+
# Write the JSON payload to a temporary file
34+
echo "$JSON_PAYLOAD" > payload.json
35+
36+
# Use curl with --data-binary to handle large file content
2837
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
29-
--header "Accept: application/vnd.api.v10+json" \
30-
--header "Content-Type: application/json" \
31-
--header "X-Api-Key: $POSTMAN_API_KEY" \
32-
--data "{\"content\": ${CONTENT}}"
38+
--header "Accept: application/vnd.api.v10+json" \
39+
--header "Content-Type: application/json" \
40+
--header "X-Api-Key: $POSTMAN_API_KEY" \
41+
--data-binary @payload.json

.github/workflows/sync-monitor.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ jobs:
2424
SCHEMA_ID=${{vars.MONITOR_DEFINITION_ID}}
2525
FILE_PATH="index.json"
2626
27-
CONTENT=$(jq -Rs . < ${SWAGGER_FILE})
27+
# Read the Swagger file content and escape it properly for JSON
28+
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
29+
30+
# Create the JSON payload with the file content as a string
31+
JSON_PAYLOAD="{\"content\": $CONTENT}"
32+
33+
# Write the JSON payload to a temporary file
34+
echo "$JSON_PAYLOAD" > payload.json
35+
36+
# Use curl with --data-binary to handle large file content
2837
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
29-
--header "Accept: application/vnd.api.v10+json" \
30-
--header "Content-Type: application/json" \
31-
--header "X-Api-Key: $POSTMAN_API_KEY" \
32-
--data "{\"content\": ${CONTENT}}"
38+
--header "Accept: application/vnd.api.v10+json" \
39+
--header "Content-Type: application/json" \
40+
--header "X-Api-Key: $POSTMAN_API_KEY" \
41+
--data-binary @payload.json

.github/workflows/sync-rooms.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ jobs:
2424
SCHEMA_ID=${{vars.ROOMS_DEFINITION_ID}}
2525
FILE_PATH="index.json"
2626
27-
CONTENT=$(jq -Rs . < ${SWAGGER_FILE})
27+
# Read the Swagger file content and escape it properly for JSON
28+
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
29+
30+
# Create the JSON payload with the file content as a string
31+
JSON_PAYLOAD="{\"content\": $CONTENT}"
32+
33+
# Write the JSON payload to a temporary file
34+
echo "$JSON_PAYLOAD" > payload.json
35+
36+
# Use curl with --data-binary to handle large file content
2837
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
29-
--header "Accept: application/vnd.api.v10+json" \
30-
--header "Content-Type: application/json" \
31-
--header "X-Api-Key: $POSTMAN_API_KEY" \
32-
--data "{\"content\": ${CONTENT}}"
38+
--header "Accept: application/vnd.api.v10+json" \
39+
--header "Content-Type: application/json" \
40+
--header "X-Api-Key: $POSTMAN_API_KEY" \
41+
--data-binary @payload.json

.github/workflows/sync-webforms.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,18 @@ jobs:
2424
SCHEMA_ID=${{vars.WEBFORMS_DEFINITION_ID}}
2525
FILE_PATH="index.json"
2626
27-
CONTENT=$(jq -Rs . < ${SWAGGER_FILE})
27+
# Read the Swagger file content and escape it properly for JSON
28+
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .)
29+
30+
# Create the JSON payload with the file content as a string
31+
JSON_PAYLOAD="{\"content\": $CONTENT}"
32+
33+
# Write the JSON payload to a temporary file
34+
echo "$JSON_PAYLOAD" > payload.json
35+
36+
# Use curl with --data-binary to handle large file content
2837
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \
29-
--header "Accept: application/vnd.api.v10+json" \
30-
--header "Content-Type: application/json" \
31-
--header "X-Api-Key: $POSTMAN_API_KEY" \
32-
--data "{\"content\": ${CONTENT}}"
38+
--header "Accept: application/vnd.api.v10+json" \
39+
--header "Content-Type: application/json" \
40+
--header "X-Api-Key: $POSTMAN_API_KEY" \
41+
--data-binary @payload.json

0 commit comments

Comments
 (0)