Skip to Content
IntegrationsGitHub

GitHub

The GitHub integration connects your repositories to TinyOps, enabling policy rules that monitor pull requests, track issues, inspect workflow runs, and take automated actions like commenting, labeling, or setting commit statuses.

Setup

Open TinyOps and go to Settings then Integrations. Click Add Integration and select GitHub.

Authorize with GitHub

You will be redirected to GitHub to authorize TinyOps. Select the organization or personal account you want to connect, then choose which repositories TinyOps can access.

Configure Webhook Events

After authorization, TinyOps automatically registers webhooks for the selected repositories. The following events are listened for:

  • pull_request.opened
  • pull_request.closed
  • push
  • issues.opened
  • workflow_run.completed

Verify Connection

Return to TinyOps and confirm the integration status shows Connected. You can now use GitHub checks and actions in your rules.

Available Checks

NameReturn TypeDescription
pr.filesarrayFiles changed in a pull request
pr.labelsarrayLabels currently applied to a PR
pr.review_statusstringReview approval status (e.g. approved, changes_requested)
repo.open_issuesnumberTotal number of open issues in the repository
repo.open_prsnumberTotal number of open pull requests
actions.statusstringLatest workflow run status (e.g. success, failure)
pr.agenumberDays since the PR was opened
pr.lines_changednumberTotal lines added plus deleted in the PR
repo.pull_requestsarrayOpen PRs with metadata (title, author, age, labels)

Available Actions

MethodParamsDescription
pr_commentbody (string, required)Posts a comment on the current pull request
create_issuetitle (string, required), body (string, optional), labels (comma-separated string, optional)Creates a new issue in the repository
add_labellabel (string, required)Adds a label to the current pull request
set_commit_statussha (required), state (pending, success, failure, or error), context (required), description (required, max 140 chars), target_url (optional)Sets a commit status check on the specified SHA

Example Rules

Stale PR Alert

Flag pull requests that have been open for more than 7 days without being merged.

stale-pr-alert.yaml
name: Stale PR Alert trigger: schedule: "0 9 * * 1-5" provider: github conditions: - check: pr.age operator: gt value: 7 - check: pr.review_status operator: neq value: approved actions: - method: pr_comment params: body: "This PR has been open for {{pr.age}} days without approval. Please review or close it." - method: add_label params: label: stale

Large PR Warning

Warn contributors when a pull request exceeds 500 lines changed.

large-pr-warning.yaml
name: Large PR Warning trigger: event: pull_request.opened provider: github conditions: - check: pr.lines_changed operator: gt value: 500 actions: - method: pr_comment params: body: "This PR changes {{pr.lines_changed}} lines. Consider splitting it into smaller, focused PRs for easier review." - method: add_label params: label: large-pr

Deploy Rollback on CI Failure

Set a failure status and create an issue when the CI workflow fails on the main branch.

deploy-rollback.yaml
name: Deploy Rollback on CI Failure trigger: event: workflow_run.completed provider: github conditions: - check: actions.status operator: eq value: failure actions: - method: set_commit_status params: sha: "{{commit.sha}}" state: failure context: "tinyops/deploy-gate" description: "Deploy blocked due to CI failure" - method: create_issue params: title: "CI failure on main — deploy blocked" body: "Workflow run failed on commit {{commit.sha}}. Investigate and fix before next deploy." labels: "bug,ci-failure"

Troubleshooting

Common issues:

  • Webhook not firing: Ensure the repository has the TinyOps webhook registered. Go to your repo Settings, then Webhooks, and verify the TinyOps endpoint is listed and active.
  • Permission denied on actions: The TinyOps GitHub App needs write access to issues and pull requests. Re-authorize and select the correct permission scopes.
  • Stale data in checks: GitHub API responses are cached for up to 60 seconds. If you just made a change, wait a moment before re-evaluating a rule.
  • pr.review_status returns empty: This check requires at least one review to be submitted. New PRs without any reviews will return an empty string.