Skip to content

Commit 299797a

Browse files
authored
Use jq to create JSON for GitHub API request
Replaced hardcoded JSON with dynamically generated JSON using jq.
1 parent c325e3e commit 299797a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

.github/workflows/send-beta-build.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,18 @@ jobs:
101101
echo " artifact_url: ${ARTIFACT_URL}"
102102
echo " zip_name: ${ZIP_NAME}"
103103
104+
JSON=$(jq -n \
105+
--arg event_type "deploy-build" \
106+
--arg source_repo "${{ github.repository }}" \
107+
--arg artifact_url "$ARTIFACT_URL" \
108+
--arg token "${{ secrets.GITHUB_TOKEN }}" \
109+
--arg subfolder "$SUBFOLDER" \
110+
--arg zip_name "$ZIP_NAME" \
111+
'{event_type: $event_type, client_payload: {source_repo: $source_repo, artifact_url: $artifact_url, token: $token, subfolder: $subfolder, zip_name: $zip_name}}' \
112+
)
113+
104114
curl -X POST \
105115
-H "Authorization: token ${{ secrets.BETA_PAT_TOKEN }}" \
106116
-H "Accept: application/vnd.github+json" \
107117
https://api.github.com/repos/${BETA_REPO}/dispatches \
108-
-d '{
109-
"event_type": "deploy-build",
110-
"client_payload": {
111-
"source_repo": "'${{ github.repository }}'",
112-
"artifact_url": "'${ARTIFACT_URL}'",
113-
"token": "'${{ secrets.GITHUB_TOKEN }}'",
114-
"subfolder": "'${SUBFOLDER}'",
115-
"zip_name": "'${ZIP_NAME}'"
116-
}
117-
}'
118+
-d "$JSON"

0 commit comments

Comments
 (0)