Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

add option to wait for heroku build on open action instead of only synchronize #21

Open
rawestmoreland opened this issue Jun 17, 2022 · 4 comments

Comments

@rawestmoreland
Copy link

I'm using this action to deploy the review app to Heroku and then deploy my frontend directory to Netlify in the same workflow.

Currently, the Netlify deploy step could be reached before Heroku is finished building the review app.

I think it would be useful to be able to wait for the Heroku build to complete on the initial open action instead of just synchronize

I can submit a PR with a solution if that's something you'd be willing to incorporate.

@pmbanugo
Copy link
Owner

That's a welcomed improvement. However, I'd say this should be added as a step without needing a new option, and it should only happen when it's opened or reopened.

@rawestmoreland
Copy link
Author

- name: Create Build
      if: ${{ github.event_name == 'pull_request' && github.event.action == 'synchronize' }}
      shell: bash
      run: |
        export SOURCE_GET_URL=$(echo ${{ toJSON(steps.source_endpoint.outputs.SOURCE_ENDPOINT) }} | jq -r '.get')
        export OUTPUT_STREAM_URL=$(curl -X POST https://api.heroku.com/apps/$APP_NAME/builds \
        -d '{"source_blob":{"url":"'"$SOURCE_GET_URL"'", "version": "${{ github.event.pull_request.head.sha }}"}}' \
        -H 'Accept: application/vnd.heroku+json; version=3' \
        -H "Content-Type: application/json" \
        -H "Authorization: Bearer ${{ inputs.api-key }}" | \
        jq -r '.output_stream_url')
        curl $OUTPUT_STREAM_URL

I was thinking to just refactor the if to:

if: ${{ github.event_name == 'pull_request' && (github.event.action == 'open' || github.event.action == 'synchronize') }}

But you would rather it have a new step @pmbanugo ?

@pmbanugo
Copy link
Owner

Yes, as a new step. I left my reason why it should be that way.

@rawestmoreland
Copy link
Author

@pmbanugo thank you for the explanation. Makes total sense. I'll update my PR 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants