GitHub bot
How to have screw-bugs Cloud test a pull request's preview from a PR comment.
Comment /screw-bugs on a pull request. The bot finds the PR's preview, runs a Cloud run planned from the diff, and comments the report.
Not open yet
Only the screw-bugs team can start Cloud runs for now, and the GitHub App installs only on uxstudioteam's repositories.
Before you start
| Who | Does what, once |
|---|---|
| Someone who can install GitHub Apps | Installs screw-bugs-cloud on the repository |
| You | Sign in with GitHub on screwbugs.dev |
| You | Have push access to the repository |
Can't install apps? Send this to your developer: "Please install the screw-bugs-cloud GitHub App on our repo."
Without a sign-in, the bot asks you to sign in, then comment again. The run is the commenter's: their test accounts, their cost.
The command
Start a comment with /screw-bugs, or tag @screw-bugs-cloud the same way. A tag further into a line, or one in code or a quote, doesn't count.
| Comment | What it does |
|---|---|
/screw-bugs | Test the preview, with cases planned from the change |
/screw-bugs check that sign-up still works | Say what to test, in your own words |
/screw-bugs --url https://โฆ | Test that address instead of the preview found |
/screw-bugs --account trial-user | Test signed in as one of your Cloud test accounts |
/screw-bugs help | Show these options on the PR |
Everything after the command, including the following lines, is the instructions (at most 4,000 characters). Put --url and --account on the /screw-bugs line, at most once each: on a later line they're read as instructions.
--account takes a label from your accounts on screwbugs.dev/accounts, not local screw-bugs ones. With a label you don't have there, the run starts, then fails, saying so.
Example
/screw-bugs --account trial-user check that the upgrade banner links to checkoutThe bot reacts ๐ to your comment and replies:
๐ screw-bugs is testing https://arlo-git-upgrade-banner-team.vercel.app/, signed in as
trial-user. The report will be here. ยท Stop this run
When the run ends, the same comment changes to:
๐ screw-bugs tested https://arlo-git-upgrade-banner-team.vercel.app/: the report.
Your comment's ๐ becomes ๐ when every test passed, or ๐ otherwise. ๐ doesn't always mean a bug: a test may not have finished, and the report's verdict says which.
How it finds the preview
- GitHub deployments of the PR's head commit (never production).
- Otherwise, the previews in Vercel's PR comment.
- Otherwise, the address saved for this repository from an earlier answer.
When there are none, several, or the one found doesn't load, the bot tries the saved address; if that doesn't load either, it asks on the PR, listing what it found. Reply:
/screw-bugs --url https://arlo-git-upgrade-banner-team.vercel.appAn address that follows the branch (as Vercel's branch previews do) is saved for the repository's next PRs. The run waits, blocked, until someone who can push answers.
Named sites
Instructions can name another site: /screw-bugs check the pricing page of copyfol.io. A small model then chooses between it and the preview; when unsure, the bot asks as above.
With --account, named sites are ignored and the preview is tested. A named site never gets the repository's preview headers. It signs in, if needed, with your own test accounts for it.
Stopping and limits
- The ๐ comment links to Stop this run (
/runs/<slug>/stop). Anyone who can push, or an admin, can stop it; the comment then says who did (or, if a report already exists, links it). - A PR has one run at a time. A new
/screw-bugswhile one waits gets a pointer to what it waits for. - While a run waits for an address, a comment with
--urlanswers it, with no ๐: its instructions and--accountare ignored. - When a run stops at a cap, the final comment says so (for example "It stopped at its time limit, so some cases may not have run").
How it works
- The App sends comment events to
/api/github/webhook, which checks GitHub's signature, then the commenter's push access and Cloud sign-in. - Runs start on a comment only, never on every push: each one costs a model and a browser.
- The run's status is one bot comment, edited in place from start to report.
- Protected previews get the repository's preview headers.
Code: apps/web/src/server/github (Cloud), comment texts in packages/shares/src/github.ts (Cloud).
For agents
- Cloud runs are team-only for now: ask the user whether they're on the screw-bugs team. If not, the bot refuses.
- Post as the user:
gh pr comment <number> --body "/screw-bugs check that sign-up still works". It runs as their GitHub account, so they need push access and a sign-in. - You can't list Cloud test accounts: ask the user for the label.
- Follow it with
gh pr view <number> --comments, about once a minute, reading the comments fromscrew-bugs-cloud[bot]:- Only comments posted after yours count: earlier runs on the PR left their own ๐ comments.
gh pr view <number> --json commentsgives each comment's author andcreatedAt. - The result is in this run's status comment: the first bot comment after yours that starts with ๐, ๐, ๐ or "couldn't finish". A ๐ comment is edited in place (keeping its place and
createdAt) when the run ends; a run that ends before testing posts its result as a new comment. Only a ๐ comment has a report link. - Everything else (questions, sign-ins, refusals) comes as new comments, and they stay after they're answered.
- Only comments posted after yours count: earlier runs on the PR left their own ๐ comments.
gh pr commentprints your comment's URL, ending#issuecomment-<id>; its reactions are atgh api repos/<owner>/<repo>/issues/comments/<id>/reactions.- No ๐ on your comment within a minute or two, and no reply? (A
--urlanswer to a waiting run never gets either: wait for the ๐ comment instead.) The commenter can't push, the App isn't installed, or the run couldn't be created (ask the user to try again). ๐ but no reply after 5 minutes? Tell the user. - A question or sign-in can wait a day: hand it to the user. Once they've answered or signed in, follow again.
- Give up about 25 minutes (for a run with the default limit) after the ๐ comment appears (or after the user tells you they've answered or signed in), and tell the user.
- The report link opens without a sign-in; its page carries the verdict and issues as text.
| The bot's comment starts with | Means | Do |
|---|---|---|
| ๐ screw-bugs is testing โฆ | Running | Keep reading |
| ๐ screw-bugs tested โฆ: the report | Done | Take the report link; read the report |
| screw-bugs couldn't finish this run โฆ | Failed, no report | Tell the user why |
| ๐ screw-bugs stopped testing โฆ | Someone stopped it, no report | Tell the user |
| @user, โฆ Which address should screw-bugs test? | Waiting for a preview address | Ask the user, or reply /screw-bugs --url โฆ |
That /screw-bugs command can't run: โฆ | Malformed command (--url, --account, a repeated flag, instructions too long), no run | Fix it and comment again |
| @user, this run signs in as your test account โฆ | Waiting for the user's sign-in (up to 1 day) | Give the user the link: only they can sign in |
| @user, what this run was asked to test needs a signed-in user โฆ | Waiting for the user to add an account and sign in (up to 1 day) | Give the user the link |
| @user, a run on this pull request is waiting โฆ | Another run is already waiting | Tell the user what it waits for |
| @user, sign in to โฆ | Not signed in, no run | Ask the user to sign in on screwbugs.dev |
| screw-bugs tests this pull request's preview โฆ | The help text | Nothing to wait for |
| @user, โฆ (any other reply) | Refused (not open yet, cap reached, a run already going), or an answer that did not reach the run | Tell the user what it says |