Uh oh!
There was an error while loading. Please reload this page.
fix(build-flutter): accept a DART_DEFINE_FILE secret for build-time dart-defines - #51
Merged
Merged
Conversation
Callers can't reference secrets.* inside a with: block when calling this reusable workflow (GitHub rejects it at parse time: "Unrecognized named-value: 'secrets'") - only the secrets: mapping can pass a secret in. Adds an optional MOBILE_API_KEY secret input instead, appended as --dart-define=API_KEY=<value> to the build args from inside this workflow's own build step, where the secrets context is actually usable.
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Problem
A calling workflow's
with:block for auses:-based job is evaluated in a restricted context that does not includesecrets(onlygithub, needs, strategy, matrix, inputs, vars). Any caller that tried to bake a secret intoflutter-build-argsvia${{ secrets.X }}insidewith:fails at parse time with:and the whole workflow run fails immediately with 0 jobs executed — not a runtime failure.
This blocks any consumer (e.g. Ximiti) that needs to pass a secret value into a
--dart-defineat build time.Fix
Add an optional
DART_DEFINE_FILEsecret input tobuild-flutter.yml, kept generic rather than tied to any one app's dart-define keys. Its content (JSON or.envformat, perflutter build --help) is written to a temp file from the build step's ownenv:block (where thesecretscontext is available, since it's evaluated at the job/step level, not inside a caller'swith:), then passed toflutter buildvia--dart-define-from-file:Callers pass the secret via the job's
secrets:mapping (e.g. a.env-formatted secret with as manyKEY=valuedart-defines as needed) instead of building--dart-define=...strings themselves inwith:.Compatibility
Fully backward compatible: the new secret input is optional and defaults to unset, so existing callers are unaffected.