Skip to main content

Git file (not runnable yet)

Goal

Know what the Git file node does today, and run a file from a repository safely. Time: 5 minutes.

Not runnable yet

The editor offers Git file (kind: git) with fields for a public repository, ref, path, and inferred language. The runner rejects kind: git. A workflow that contains it won’t save or run, even if the editor verified the repository.

Use Code file after checkout: clone or check out the repository locally, review the revision, then point a code_file block at it.

The workaround

# One-time (or in a setup step you trust): check out a reviewed revision
git clone https://github.com/acme/scripts ~/src/acme-scripts
git -C ~/src/acme-scripts checkout v1.4.2
schema: 1
name: Run reviewed script
id: run-reviewed-script
folder: ~/src/acme-scripts
blocks:
  - id: report
    kind: code_file
    path: tools/report.py
    outputs:
      type: object
      properties:
        ok: { type: boolean }

Pinning to a tag or commit you’ve reviewed means the code you run is code you’ve read. That’s also why this route is safer than running whatever happens to be on a remote branch.

Check your run

Save accepts the code_file version. If you put kind: git in YAML, Save reports 'kind' must be code, code_file, http, mcp, ai, decision, loop.

Exercise

Write the YAML for a Code file block that runs scripts/build.ps1 from your checkout with the args -Configuration Release.

Details
- id: build
  kind: code_file
  path: scripts/build.ps1
  args: -Configuration Release

.ps1 means the language is inferred as powershell.