Run a script
Hand a capture or its link to your own program from a workflow, safely.
A run_script step runs a program with arguments, for example to file an issue with the screenshot attached.
Scripts are available in the version from this website. The Mac App Store version can’t run them.
[[step]]
type = "run_script"
executable = "~/bin/file-issue"
args = ["--attach", "{file}", "--title", "{title}"]
env = { JIRA_TOKEN = { keychain = "jira-token" } }
output_is_link = true
timeout_s = 60
| Key | Notes |
|---|---|
executable | Required. The program to run. |
args | A list of arguments. Template tokens are expanded in each one. |
env | Extra environment variables. Read secrets from your Keychain with { keychain = "item name" }; never write them in the file. |
timeout_s | 1–3600 seconds. |
output_is_link | true if the program prints a link that later steps (Copy link) should use. |
Approve first#
A workflow that runs programs needs your approval before it runs. The editor shows “This workflow runs programs on your Mac” and lists them; click Allow.
The approval covers the workflow file and every program it runs. If either changes, Glimmer asks again (“This workflow changed since you allowed it”). Approvals are kept outside the workflows folder, so a shared folder can’t approve itself.
How it runs#
- The program runs directly, never through a shell. Shells with
-cor-eand tokens are refused. - Standard input is empty, and output is capped at 64 KB.
- The environment is fixed:
PATH,HOME,LANG,TMPDIR(the run’s own work folder), plus:
| Variable | Value |
|---|---|
GLIMMER_FILE | The capture file |
GLIMMER_LINK | The upload link, if any |
GLIMMER_RUN_ID | This run’s ID |
GLIMMER_RUN_CHAIN | The IDs of runs that started this one |
GLIMMER_WORKFLOW | The workflow’s name |
GLIMMER_MATCH | For runs started by Sentinel: the screen text that matched |
- At the timeout, the program is asked to stop, then stopped.
Next#
Something missing or unclear? Write to [email protected].