Skip to content

Commit

Permalink
refactored the json payload
Browse files Browse the repository at this point in the history
  • Loading branch information
sangeet-joy_xero committed Sep 23, 2024
1 parent e0bb83a commit d21b5ae
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d21b5ae

Please sign in to comment.