From d21b5aef56638909048025470181f03d58e2353f Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Mon, 23 Sep 2024 13:16:02 +0530 Subject: [PATCH] refactored the json payload --- .github/workflows/pr.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f3fd77b4b..689877bd2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -57,12 +57,20 @@ jobs: run: | dispatchId=$((10000 + RANDOM % 90000)) echo "dispatchId: $dispatchId" + + json_payload=$(jq -n \ + --arg ref "PETOSS-536-enabling-workflow-dispatch" \ + --arg dispatch_id "$dispatchId" \ + --arg branch_name "${{github.head_ref}}" + '{ref: $ref, inputs: {dispatch_id: $dispatch_id, branch_name: $branch_name}}' + + ) curl -X POST \ -H 'Authorization: Bearer ${{ steps.get_access_token.outputs.result }}' \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/xero-internal/xeroapi-sdk-codegen/actions/workflows/pr.yml/dispatches \ - -d '{"ref":"PETOSS-536-enabling-workflow-dispatch","inputs":{"branch_name": "${{github.head_ref}}", "dispatch_id": $dispatchId}}' + -d "$json_payload" # - name: Get workflow run ID # id: get-run-id