Skip to content

Commit

Permalink
fix: use /review-apps endpoint for deletion rather than /app endpoint (
Browse files Browse the repository at this point in the history
…pmbanugo#19)

* doc: update description about differences between v1 & v2

* Fix pr-predestroy script not running

The pr-predestroy script is normally run when a PR is closed and its
review app is destroyed[1]. In the current release (v2.0.0) it is not
being triggered.

This commit fixes that by calling the /review-apps endpoint instead
of the /apps endpoint to delete the review app.

[1] https://devcenter.heroku.com/articles/github-integration-review-apps#pr-predestroy-script

Co-authored-by: Peter Mbanugo <[email protected]>
  • Loading branch information
ch2ch3 and pmbanugo committed May 18, 2022
1 parent 9dc481f commit 7be0f88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ runs:
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }}
shell: bash
run: |
curl -X DELETE https://api.heroku.com/apps/$APP_NAME \
export REVIEW_APP_ID=$(curl -X GET https://api.heroku.com/apps/$APP_NAME/review-app \
-H 'Accept: application/vnd.heroku+json; version=3' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ inputs.api-key }}" | \
jq -r '.id')
curl -X DELETE https://api.heroku.com/review-apps/$REVIEW_APP_ID \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3" \
-H "Authorization: Bearer ${{ inputs.api-key }}"

0 comments on commit 7be0f88

Please sign in to comment.