diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 856af3bec..da0dbba1d 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -19,16 +19,29 @@ jobs: id: create_deployment run: | # Create a deployment - curl -X POST \ + out=$(curl -fSsL -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/${{ github.repository }}/deployments \ - -d '{"ref": "${{ github.sha }}", "environment": "staging", "auto_merge": false, "required_contexts": [], "description": "Deploying new release"}' + -d '{"ref": "${{ github.sha }}", "environment": "staging", "auto_merge": false, "required_contexts": [], "description": "Deploying new release"}'); + + if [ -z "$out" ]; then + echo "Invalid output" + exit 1; + fi; + + id=$(cat $out | jq -r .id); + + if [ -z "$id" ]; then + echo "Invalid ID" + exit 1; + fi; + + echo "id=$id" >> $GITHUB_OUTPUT; env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Set Deployment Status to Pending - id: set_deployment_status_pending run: | curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \