deno eval: Run Inline Code in CI
deno eval runs a string of TypeScript or JavaScript directly, without a file.
For a one-line check or a small transform step in a pipeline, deno eval avoids creating a throwaway script file.
What it does
deno eval executes the code you pass as an argument under the permission sandbox, just like deno run. It is handy for quick computations, environment checks, or printing a value in a CI step.
Common usage
deno eval "console.log(Deno.version.deno)"
deno eval --ext=ts "const n: number = 41; console.log(n + 1)"
# read an env var (needs permission)
deno eval --allow-env "console.log(Deno.env.get('CI'))"Options
| Flag | What it does |
|---|---|
| <code> | The source string to execute |
| --ext <ext> | Treat the code as ts or js |
| --allow-env / --allow-net | Grant permissions to the snippet |
| --no-check | Skip type-checking the snippet |
In CI
Use deno eval for tiny inline steps such as asserting a version or transforming a value, but move anything non-trivial into a real file so it can be type-checked and tested. The sandbox applies, so still pass the permissions the snippet needs.
Common errors in CI
"Requires env access to ..." means the snippet read Deno.env without --allow-env. A TS error like "Cannot find name" appears when --ext=ts code references something undeclared. Shell quoting is a frequent culprit: an unescaped quote in the snippet produces a confusing parse error.