Skip to content

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

Merged
jww3 merged 2 commits into
mainfrom
test-ubuntu-git-warning
Feb 22, 2024
Merged

Warn on attempts to publish test-ubuntu-git from non-main branch.#1623
jww3 merged 2 commits into
mainfrom
test-ubuntu-git-warning

Conversation

@jww3

@jww3 jww3 commented Feb 22, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
@jww3
jww3 deleted the test-ubuntu-git-warning branch February 22, 2024 13:38
@Juan48302

Copy link
Copy Markdown

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