Slide 7
Slide 7 text
Besides the REST API wrapper, the webhooks handler we are
also working on tools for OAuth (both client and server), a
GraphQL client and a low-level that helps with GitHub Apps.
To build actual GitHub apps you can use Probot, which is not
part of Octokit but is using it internally. Probot is an
independent Open Source project, initiated as a side project
by Brandon Keepers.
Here you can see the source code for the work in progress
app. In less than 20 lines of code, it checks if a pull request has
"WIP" in its title and sets the pull request status accordingly.
Itʼs also a great segue because JavaScript Octokit is very
much work
Probot
module.exports = (robot)= > {
robot.on([
'pull_request.opened',
'pull_request.edited'
], ({github, payload, repo}) => {
const {title, head} = payload.pull_request
const isWip = /\bwip\b/i.test(title)
github.repos.createStatus(repo({
sha: head.sha,
state: isWip ? 'pending' : 'success',
description: isWip
? 'work in progress – do not merge!'
: 'ready for review',
context: 'WIP'
}))
})
}
@gr2m | GitHub Constellation LA 2018