fix(ci): skip image push for forked pull requests#21
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR updates the Docker CI workflow to safely handle pull requests opened from forked repositories.
Before this change, the workflow always logged in to the CI registry and always pushed the Docker image:
This works for same-repository pull requests and trusted events, but fails for forked pull requests because they do not have write access to the package registry.
This PR adds a CI push policy that detects whether the workflow is running from a forked pull request.
Behavior after this change:
The workflow now skips registry login and disables Docker image push for forked pull requests, while preserving the existing push behavior for trusted CI runs.
This PR also fixes the CI image tag step by removing the undefined
IMAGE_TAGSvariable and logging the actual generatedci_tag.Related Issue
Fixes #
Type of Change
How to Test
Open a pull request from a branch inside the same repository.
Expected result:
Open a pull request from a forked repository.
Expected result:
Verify that the generated CI image tag is correctly printed in the workflow logs.
Verify that trusted non-PR events still push the CI image as before.
Checklist