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

Warn on attempts to publish test-ubuntu-git from non-main branch. #1623

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

jww3
Copy link
Contributor

@jww3 jww3 commented Feb 22, 2024

When we built the test-ubuntu-git image generation workflow, we made the decision to only allow the test-ubuntu-git container image to be published from the main branch of actions/checkout. (see #1617)

This PR updates the workflow to explain (via a warning message) why an image push attempt from a non-main branch didn't have the desired effect (for users that weren't paying close attention to the label of the checkbox which reads: "Publish to ghcr.io? (main branch only)").

Note that push is an opt-in behavior of reusable workflow docker/build-push-action.
There's diagnostic value in the build attempt that precedes any would-be image push, so I chose not to fail the workflow outright, but rather to let the build proceed and simply skip the push.

@jww3 jww3 requested a review from a team as a code owner February 22, 2024 12:55
Comment on lines +46 to +47
if: ${{ inputs.publish && github.ref_name != 'main' }}
run: echo "::warning::test-ubuntu-git images can only be published from the actions/checkout 'main' branch. Workflow will continue with push/publish disabled."
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see similar conditional logic in line 57

@jww3 jww3 merged commit b32f140 into main Feb 22, 2024
12 checks passed
@jww3 jww3 deleted the test-ubuntu-git-warning branch February 22, 2024 13:38
@Juan48302
Copy link

CODEOWNERS.txt

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.

3 participants