Repository navigation
fix: avoid secrets context in pub publish step conditions - #542
Merged
Merged
Conversation
GitHub does not expose the `secrets` context to step-level `if:` conditions, so dart_pub_publish.yml and flutter_pub_publish.yml failed workflow validation on every push. Map `pub_credentials` to a job-level `PUB_CREDENTIALS` env var and check that instead. The credentials are also now written via the env var rather than interpolated into the script. Adds a structural test that rejects `secrets.` in step conditions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
marcossevilla
approved these changes
Oct 28, 2026
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
dart_pub_publish.ymlandflutter_pub_publish.ymlfailed workflow validation on every push (0s runs, "workflow file issue"). Every recorded run since 2025-09-04 has failed. The cause is step-levelif:conditions that referencesecrets.pub_credentials. GitHub doesn't make thesecretscontext available there.Changes
secrets.pub_credentialsto a job-levelPUB_CREDENTIALSenv var and checkenv.PUB_CREDENTIALSin the step conditions. It has to be job-level because a step'sif:is evaluated before that step's ownenv:."$PUB_CREDENTIALS"instead of putting${{ secrets.pub_credentials }}into the script, which avoids shell-quoting/injection issues with the JSON.secrets.in a stepif:. I confirmed it fails against the previous versions of both files.Type of Change
🤖 Generated with Claude Code