Share Rego policy as a GitHub Gist
rego_playground_sharePublish Rego policies as public GitHub Gists to share with teammates or create reproducible examples. Include query, input, or data to bundle evaluation context for OPA or Conftest.
Instructions
Share a Rego policy with teammates or create a reproducible example by publishing it as a public GitHub Gist. Returns { gistUrl, rawPolicyUrl, id }: the gistUrl renders the policy with syntax highlighting on github.com; the rawPolicyUrl can be passed directly to OPA (opa eval -d <rawPolicyUrl> <query>) or used as a data source in Conftest. When query, input, or data are supplied, a metadata.json file is bundled into the Gist so recipients have the full evaluation context to reproduce results. Each call creates a new Gist -- use the returned id to reference it later. Requires GITHUB_TOKEN in the environment (GitHub personal access token with the "gist" scope); returns GITHUB_TOKEN_MISSING with setup instructions if unset.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy | Yes | Rego source code to share (the contents of a .rego file). | |
| query | No | Default query to evaluate against the policy, e.g. "data.authz.allow". Stored in metadata.json alongside the policy file. | |
| input | No | Input document as a JSON string. Stored in metadata.json alongside the policy file. | |
| data | No | Data document as a JSON string. Stored in metadata.json alongside the policy file. | |
| description | No | Short description for the Gist (shown on github.com/gists). |