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
Navigate to Integrations
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.openedpull_request.closedpushissues.openedworkflow_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
| Name | Return Type | Description |
|---|---|---|
pr.files | array | Files changed in a pull request |
pr.labels | array | Labels currently applied to a PR |
pr.review_status | string | Review approval status (e.g. approved, changes_requested) |
repo.open_issues | number | Total number of open issues in the repository |
repo.open_prs | number | Total number of open pull requests |
actions.status | string | Latest workflow run status (e.g. success, failure) |
pr.age | number | Days since the PR was opened |
pr.lines_changed | number | Total lines added plus deleted in the PR |
repo.pull_requests | array | Open PRs with metadata (title, author, age, labels) |
Available Actions
| Method | Params | Description |
|---|---|---|
pr_comment | body (string, required) | Posts a comment on the current pull request |
create_issue | title (string, required), body (string, optional), labels (comma-separated string, optional) | Creates a new issue in the repository |
add_label | label (string, required) | Adds a label to the current pull request |
set_commit_status | sha (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.
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: staleLarge PR Warning
Warn contributors when a pull request exceeds 500 lines changed.
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-prDeploy Rollback on CI Failure
Set a failure status and create an issue when the CI workflow fails on the main branch.
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_statusreturns empty: This check requires at least one review to be submitted. New PRs without any reviews will return an empty string.