Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you set the Log URL based on output from a previous step? #1

Open
NullVoxPopuli opened this issue Sep 8, 2019 · 4 comments
Open

Comments

@NullVoxPopuli
Copy link

I have dynamic subdomains / deploys with netlify, and I can get the URL from the deploy output via jq. So, in the previous step, I have an environment variable that has the deploy URL. But... I don't know how to get it into the next step.

@colinjfw
Copy link
Collaborator

colinjfw commented Sep 9, 2019

Hey thanks @NullVoxPopuli for the first issue!

I don't know much about some of the more complex parts of GitHub actions. I do believe you can set the "output" of a script (ie. setting a url) and then maybe pass it back in as a step variable?

There is code for this in the toolkit:
https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L88

And then you could maybe include this by grabbing the output from the steps object.

with:
  url: ${{ steps.url }}

There may be a better approach to this.

@chrnorm
Copy link

chrnorm commented Sep 20, 2019

@NullVoxPopuli I recently ran into this issue in my CI pipeline using the zeit now CLI to deploy my frontend. My workaround was to set my environment variable as an output from my run step in my job as follows:

- name: Export URLs to environment variables
        id: url
        run: |
          FRONTEND_URL=mysite.com # replace this with your jq command
          echo ::set-output name=frontend_url::${FRONTEND_URL}

then you can use it in the deliverybot action as follows (untested!):

- name: 'deployment success'
      if: success()
      uses: 'deliverybot/deployment-status@master'
      with:
        log-url: ${{ steps.url.outputs.frontend_url }}
        state: 'success'
        token: '${{ github.token }}'

note that the id property of the url step must be set for you to reference it correctly in the deliverybot step. Here's some more details about setting output parameters.

@colinjfw
Copy link
Collaborator

@chrnorm thanks for this, this is a super useful tip for GitHub actions.

@savitha-atg
Copy link

savitha-atg commented Jul 26, 2022

Where does the log URL show up in the environments page? I see a button for View deployment (see attachment), which takes me to the environment-url if set, but I don't see any place that'll take a user to the log URL. Thanks.

Screen Shot 2022-07-26 at 6 13 45 PM

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

No branches or pull requests

4 participants