Repository navigation
fix(ci): move secrets reference out of steps.if in validate-app-spec - #6
Merged
Merged
Conversation
GitHub forbids the `secrets` context in `steps.if` expressions, which
caused the workflow to fail at parse time ("workflow file issue", no
jobs ran). `secrets` is permitted in `jobs.<id>.env`, so expose the
token's presence as `HAS_DO_TOKEN` there and branch on that env var.
Verified with actionlint (exit 0).
There was a problem hiding this comment.
Pull request overview
Fixes a GitHub Actions workflow-load failure in Validate App Spec by removing use of the secrets context from steps.if (which causes the workflow to be rejected at parse time) and replacing it with a job-level env flag derived from the secret.
Changes:
- Adds a job-level
env.HAS_DO_TOKENcomputed fromsecrets.DIGITALOCEAN_ACCESS_TOKEN. - Updates step conditions to branch on
env.HAS_DO_TOKENinstead of referencingsecretsinsteps.if.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problem
The
Validate App Specworkflow has been failing on every run with "workflow file issue" — no jobs executed and no logs were produced (the logs API returned 404).actionlintpinpointed the cause:Per GitHub's context-availability table, the
secretscontext is not permitted insteps.if— onlygithub, needs, strategy, matrix, job, runner, env, vars, steps, inputsare. GitHub has been enforcing this more strictly, so the workflow now refuses to load.Fix
Move the secret-presence check into a job-level
env:var (wheresecretsis allowed per the same table), then branch the three steps onenv.HAS_DO_TOKEN:Behavior is preserved: without a token the YAML syntax check runs; with a token
doctl apps spec validateruns instead.Verification
actionlint .github/workflows/validate-app-spec.yml→ exit 0, no findingssecretsis listed forjobs.<job_id>.envbut notjobs.<job_id>.steps.ifin the docs table