Skip to content

[eas-cli] Accept template expressions where the workflow schema wants a URI - #4255

Open
dennytosp wants to merge 1 commit into
expo:mainfrom
dennytosp:fix/workflow-validate-template-expressions
Open

[eas-cli] Accept template expressions where the workflow schema wants a URI#4255
dennytosp wants to merge 1 commit into
expo:mainfrom
dennytosp:fix/workflow-validate-template-expressions

Conversation

@dennytosp

Copy link
Copy Markdown

Why

Fixes #3404.

eas workflow:validate and eas workflow:create compile the published workflow schema with AJV, and AJV is configured with ajv-formats, so format keywords are enforced. The schema declares the Slack job's webhook_url as {"type": "string", "format": "uri"}, but a ${{ ... }} expression is only replaced with its value when the workflow runs. ${{ env.SLACK_WEBHOOK_URL }} is not a URI, so the check fails on a workflow that is valid and that the server accepts.

The consequence is worse than one wrong message. Jobs are matched with anyOf, so the failed format drops both Slack branches and the job is then reported against every other job type. Against the schema at https://api.expo.dev/v2/workflows/schema today, a single interpolated webhook_url produces 71 errors, starting with the misleading The value at /jobs/notify/type must be equal to constant.

The CLI already has this idea for build profiles, where buildProfileIsInterpolated skips the check for an interpolated params.profile.

How

The workflow schema is now compiled with a validator whose formats let an interpolated value through, instead of the shared one. Each format registered on the validator is rewrapped so it first accepts a string containing a ${{ ... }} expression and otherwise defers to the original check, in whichever of the shapes AJV accepts a format (RegExp, validator function, or definition object). Number formats and formats registered as true are left alone, since neither can hold an expression.

Formats keep being enforced for everything the CLI can actually resolve: a literal webhook_url that is not a URI is still rejected locally, exactly as before. uri is the only format the current schema uses, but relaxing them all means a format added to the schema later does not reintroduce the same failure.

Test Plan

yarn test, yarn typecheck, yarn lint and yarn fmt:check all pass.

Added src/commandUtils/workflow/__tests__/validation-test.ts, which runs validateWorkflowFileAsync against a schema fixture shaped like the published one (anyOf job types, Slack params as anyOf, webhook_url with format: uri). It covers the three cases that matter: an interpolated webhook_url validates, a literal URI validates, and a literal non-URI is still rejected. On main the first of those fails.

@dennytosp
dennytosp force-pushed the fix/workflow-validate-template-expressions branch from 3769ee3 to e271ec5 Compare August 22, 2026 09:01
@github-actions

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eas workflow:validate fails on slack job type when webhook_url uses a template expression

1 participant