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

Change behaviour of NO_PUSH to be boolean #107

Merged
merged 7 commits into from
Dec 4, 2023

Conversation

sgibson91
Copy link
Member

@sgibson91 sgibson91 commented Nov 28, 2023

I have been trying to use this variable in GitHub Actions like so:

NO_PUSH: ${{ github.event_name == 'pull_request' }}

i.e. a build triggered by a PR would not be pushed to a registry, but a build triggered by a push to main (or whatever other events are configured by the workflow) would be pushed, which I believe is a pretty common use case.

I was surprised that this didn't work and my builds were never pushed to a registry on either trigger, and I realised this is because the action only checks if NO_PUSH is not empty rather than treating it like a boolean. The only way to get the desired behaviour (without this PR or some other change) would be to have two workflow files that are identical other than the one triggered by a PR has NO_PUSH set. You can see this in the build.yaml and test.yaml files here: https://github.com/2i2c-org/hub-user-image-template/tree/main/.github/workflows

This PR changes the behaviour of NO_PUSH to be more boolean and allows us to achieve the desired workflow in a single workflow file and without duplicating code.

Previously, any string passed to INPUT_NO_PUSH would prevent pushing. We
change this to expect boolean input and provide an informative error
message if true or false is not provided.
Copy link

welcome bot commented Nov 28, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

create_docker_image.sh Outdated Show resolved Hide resolved
@sgibson91 sgibson91 merged commit b3cd89f into jupyterhub:master Dec 4, 2023
17 checks passed
Copy link

welcome bot commented Dec 4, 2023

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

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

Successfully merging this pull request may close these issues.

2 participants