Skip to content

GitHub pull request tests

When a pull request opens, InsightJet can make a ticket from it and test your app against that ticket. There are two ways:

  • The GitHub App posts a comment on the pull request with a link to the ticket and a tick-box. Ticking the box starts a ticket run, and the comment shows the result.
  • Your own workflow calls InsightJet with an API key, starts the test and reads the result.
  1. Open Settings → Integrations → GitHub. Under Pull request tickets, click Connect the GitHub App and install it on your GitHub account or organization. To add another account, click Add another account. To remove one, uninstall the App on GitHub.
  2. Open Settings → Automations and add an automation: choose the Repository and Branch, tick A pull request opens, and choose Create a ticket. Only repositories you can see through the App are offered.
  1. Someone opens a pull request against the watched branch.
  2. InsightJet makes a ticket from its title, description and changed files, and the App posts one comment with the ticket’s link and a Test this pull request box.
  3. Someone ticks the box. Anyone with write or admin access to the repository can do this; they need no InsightJet account. The test runs as the person who made the automation.
  4. The comment changes to Running, then to the result: passed, failed or could not check, with a link to the shared result when one can be made, and a Test again box.

Only pull requests by the repository’s owner, members and collaborators make a ticket. Others are skipped: no ticket and no comment. When the pull request is merged later, the same ticket is updated rather than a second one made.

The App keeps one comment per pull request and edits it in place, so a result is never posted twice.

  • 20 tests per GitHub App installation in any 24 hours, counted from ticks of the box. A tick that starts nothing does not count.
  • A test uses the agent-hours of the person who made the automation. When they are out of hours, or all their agents are busy, the comment says so and the box comes back.
  • Results are posted for runs up to 7 days old.

The Pull request tests panel on the GitHub settings page shows, for each account, how many tests were started in the last 24 hours, when the allowance frees up, the latest tests and how each went, and how many pull requests were skipped for their author.

Your workflow can make the ticket and start the test itself, with an assistant (MCP) key; an API key (ijk_) is refused here. InsightJet also publishes a GitHub Action, InsightJet/run-tests, that makes these calls for you: see GitHub Actions.

You still need an automation in Settings → Automations that watches the repository and branch with A pull request opens.

  1. Make an assistant (MCP) key (see Keys) and save it as a repository secret, for example INSIGHTJET_KEY.
  2. When a pull request opens, send POST https://insightjet.ai/api/github-action/pull-request-tests with the header Authorization: Bearer <key> and a JSON body.
  3. If a test started, ask GET https://insightjet.ai/api/github-action/ticket-runs/<ticketRunId> with the same header until stillRunning is false.

The body:

FieldTypeRequiredWhat it is
repoFullNamestringYesowner/repository
prNumbernumberYesThe pull request’s number
titlestringYesIts title, up to 256 characters
bodystringNoIts description, up to 65,536 characters
authorstringYesThe login of whoever opened it
authorAssociationstringYesGitHub’s author_association, such as MEMBER
branchstringYesThe branch it is opened against
changedFilesstring[]NoFile names it changes, up to 300
startbooleanNotrue to start a test now. Default false: the ticket is made, nothing runs

Any other field is refused.

Terminal window
curl -s -X POST https://insightjet.ai/api/github-action/pull-request-tests \
-H "Authorization: Bearer $INSIGHTJET_KEY" \
-H "Content-Type: application/json" \
-d '{"repoFullName":"acme/shop","prNumber":42,"title":"Add coupon field","author":"dana","authorAssociation":"MEMBER","branch":"main","start":true}'

POST answers 200 with the ticket’s id and link, started, the ticketRunId of a started test, and appWillPost (whether the GitHub App will also comment). A pull request by someone the repository does not know answers skipped. A test that could not start answers started: false with a reason:

ReasonMeaning
daily_limitThe key has started its 20 runs for the last 24 hours. canStartAgainAt says when it frees up.
already_runningA test of this ticket is still running.
sign_in_expiredThe InsightJet sign-in of the person who made the automation has expired. Ask them to sign in to InsightJet again.
could_not_checkAnything else on InsightJet’s side.

GET answers { "stillRunning": true }, or stillRunning: false with a verdict (passed, failed or could_not_check) and the comment text.

Other statuses: 400 for a body that is wrong, 401 for a missing or expired key, 403 when the key’s owner has left the key’s team, 404 when no automation watches that repository and branch (or the run is not one this key started), 413 for a body over 256 KB, 429 after more than 30 POSTs or 120 GETs a minute for one account (Retry-After says how long to wait), and 503 when the result could not be read just then.

Refusals on InsightJet’s side answer 200, so a refusal never has to fail your build. Print the answer and carry on.