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 to get preview url, editor url and themeid from one step to another #29

Open
alexantom opened this issue Dec 10, 2021 · 4 comments
Open

Comments

@alexantom
Copy link

I would like to output preview url, editor URL and themeid so that it can be accessed in next steps. Is this something possible now or do we need to add below scripts.

entrypoint.sh

preview_url="$(cat "$theme_push_log" | tail -n 1 | jq -r '.theme.preview_url')"
editor_url="$(cat "$theme_push_log" | tail -n 1 | jq -r '.theme.editor_url')"
theme_id="$(cat "$theme_push_log" | tail -n 1 | jq -r '.theme.id')"
echo "::set-output name=preview_url::$preview_url"
echo "::set-output name=editor_url::$editor_url"
echo "::set-output name=theme_id::$theme_id"

ci.yml

- name: Lighthouse
        id: lighthouse
        uses: shopify/lighthouse-ci-action@1.0
        with:
          app_id: ${{ secrets.SHOP_APP_ID }}
          app_password: ${{ secrets.SHOP_APP_PASSWORD }}
          store:${{ secrets.SHOP}}
          password: ${{ secrets.SHOP_PASSWORD }}
- name: Print Deploy Output
        run: |
          echo "::Preview Url:: ${{steps.lighthouse.outputs.preview_url}}"
          echo "::Editor Url:: ${{steps.lighthouse.outputs.editor_url}}"
          echo "::Theme ID:: ${{steps.lighthouse.outputs.theme_id}}"
@alexantom
Copy link
Author

Changes can be found here

alexantom@a4a7467

@charlespwd
Copy link
Collaborator

We don't output them now. But maybe we should!

Also IIRC, it's good practice to declare your outputs in the actions.yml output field.

But I'm not sure that works if we delete the theme after.

https://github.com/Shopify/lighthouse-ci-action/blob/main/entrypoint.sh#L89

@alexantom
Copy link
Author

alexantom commented Dec 10, 2021

@charlespwd i missed the cleanup job :), i was trying to reuse this action to create feature branch based environment for testing.

I couldn't see the logs associated with cleanup job here
https://github.com/Shopify/lighthouse-ci-action/runs/4048646600?check_suite_focus=true

@charlespwd
Copy link
Collaborator

That's a good idea. All you really need is this part here:

https://github.com/Shopify/lighthouse-ci-action/blob/main/entrypoint.sh#L118-L144

IIRC development themes get cleaned up after two weeks of inactivity.

You might be even be able to pipe the output of that into https://github.com/shopify/github-deployment-action to get a GitHub environment for it.

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

2 participants