GitHub integration
How Gitpay signs users in with GitHub, reads issues and pull requests, verifies solutions, and comments on GitHub.
Gitpay doesn’t need a GitHub App installed on your repository. It works through OAuth and the GitHub REST API.
Sign-in and permissions
| Flow | Route | Used for |
|---|---|---|
| Sign in with GitHub | /authorize/github |
Signing in, and linking the GitHub identity used to verify pull request authors |
| Connect GitHub to an existing account | /connect/github |
Users who signed up with email |
| Private repositories | /authorize/github/private |
Importing issues from private repositories |
| Disconnect | /authorize/github/disconnect |
Removing the link |
Commenting on a pull request as the user, for imported pull requests, needs an extra permission that Gitpay asks for the first time it’s used. The private import flow signs its state parameter, so the user ID can’t be forged in the callback.
What Gitpay reads
- Issues: title, body, state, labels and assignees, when an issue is imported and whenever its state is synced.
- Pull requests: author, merge state, base repository and body, when a solution is checked or a pull request is imported.
A daily job syncs issue states, so an issue closed on GitHub is closed on Gitpay.
Solution checks
When a contributor sends a solution, Gitpay checks that:
- the user has a connected GitHub account;
- that account authored the pull request;
- the pull request is merged into the issue’s repository;
- the pull request references the issue;
- the issue is closed.
If they all pass, the bounty is transferred. See How bounties are paid out.
Comments Gitpay posts
Comments are posted only in production, and only for GitHub issues. The code is in src/bot/.
| When | Comment |
|---|---|
| An issue is imported | Links the issue to its Gitpay page. |
| A bounty is recorded | States the bounty amount, with a link. |
| Weekly, for issues closed with an unpaid bounty | Reminds the pull request author to claim the bounty. |
| A user imports their pull request and chooses to post | Posted from the user’s own account, with the price and a payment link. |
Bitbucket
Issues can also be imported from Bitbucket, and users can sign in with Bitbucket. Solution checks and comments are GitHub-only.