FirebaseExtended / action-hosting-deploy

Automatically deploy shareable previews for your Firebase Hosting sites
https://firebase.google.com/docs/hosting/github-integration
Apache License 2.0
695 stars 202 forks source link

Get the preview URL in a variable #270

Closed naturedamends closed 1 year ago

naturedamends commented 1 year ago

The use case you're trying to solve

I need a way to pull the preview url information and use it in a variable inside of GitHub actions (steps). I'm not sure if I can do this with GitHub actions. But i'm certain I can and if not i'll do it another way. But I can't see a config option here for that either. I'm aware I can just do it by the command line and parse the output to get the URL and just write it to file or something for it to be reused.

I might find something that allows me to do just that... not sure.... however, would be nice if was documented.

My issue is that the preview channel expires and I then need to go and change the string that the action uses.

Other considerations

Preview channels with an expiry time that's greater than 30d would also work for me. But not for larger outfits.

I could create an action or something that does this with the cli. but i'm not doing that because I have a life.

you already do await postChannelSuccessComment(octokit, context, deployment, commitId);

What I need is to pipe this information into another GitHub action job step. await postChannelSuccessInformationSave(). As I mentioned, I would be nice if this has multiple branches. Simple write to variable(or file) in the action. I assume its possible someone could end-up with a service creating the channels for their sites. And pass between jobs. not sure I can parse the summary

naturedamends commented 1 year ago

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-defining-outputs-for-a-job

naturedamends commented 1 year ago

nvm. you can close. it calls setOutput( - adding an id, I can then use it in other steps with steps.run_tests.outputs.urls How ever I may need to parse this if it returns multiple urls.

 - name: print outputs
        env:
          ACTION_URLS: ${{fromJson(steps.preview_deploy.outputs.urls)[0]}}