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
KeyNotes
executableRequired. The program to run.
argsA list of arguments. Template tokens are expanded in each one.
envExtra environment variables. Read secrets from your Keychain with { keychain = "item name" }; never write them in the file.
timeout_s1–3600 seconds.
output_is_linktrue 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 -c or -e and 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:
VariableValue
GLIMMER_FILEThe capture file
GLIMMER_LINKThe upload link, if any
GLIMMER_RUN_IDThis run’s ID
GLIMMER_RUN_CHAINThe IDs of runs that started this one
GLIMMER_WORKFLOWThe workflow’s name
GLIMMER_MATCHFor 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].

↑ ↓ to move, Enter to open, Esc to close