TERMORQ_INPUT is a path
Read workflow input from TERMORQ_INPUT the right way. Time: 10 minutes. Needs: Python 3 and Bash with jq.
The rule
TERMORQ_INPUT is an environment variable that contains a file path. Open that file, then parse its contents.
- It’s not the JSON itself. Don’t run
json.loads(os.environ["TERMORQ_INPUT"]). - stdin is closed, so reading stdin gets you nothing.
- Code bodies are not template-expanded, so
{{ ... }}inside source code stays as literal text.
The file contains only the paths listed in uses, nested exactly as their dotted paths:
You read data["trigger"]["text"], not a flattened data["text"].
Try it
Paste this workflow. It uses a mock HTTP block, so it makes no network calls:
show → Output contains summary: "users -> 200". The stderr line shows a temporary path. The file is created with mode 0600 on Unix and deleted when the block ends.
When there’s no input
- If
usesis empty, a full run provides no input file, soTERMORQ_INPUTis unset. - If a listed path isn’t available, for example because the trigger didn’t provide
trigger.text, the block fails before your code starts. Listing a path doesn’t give it a default value.
Request only the values a block needs. This is good data minimisation, because a block can’t leak data it never received. It isn’t a sandbox, though: your code still runs with your user’s permissions.
Rewrite show in Bash using jq. It should publish the same summary property.
Reference: What TERMORQ_INPUT is for