fix: skip Docker login and push steps for fork PRs #1850
Merged
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.
Summary
Fixes Docker workflow failures when running from fork PRs by skipping login and push steps that require the GHCR_TOKEN secret.
Problem
The workflow was failing with "Password required" error when running on fork PRs (like the ones from gounthar/quickstart-tutorials):
GitHub doesn't provide repository secrets to fork PRs for security reasons, but the workflow was attempting to login and push to GHCR regardless.
Root Cause
The workflow detects forks with the
IS_FORKcheck but doesn't use this check to skip Docker login and image push operations:Then later, login and build-push steps would attempt to run even when
IS_FORK == 'true'.Solution
Added
&& env.IS_FORK == 'false'to the condition of:This ensures these steps only run when the PR is from the upstream repository, where the GHCR_TOKEN secret is available.
Impact
Testing
This fix will allow fork PRs (like those from @gounthar) to pass the Docker workflow checks.