-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (42 loc) · 1.39 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Checks API example
// See: https://developer.github.com/v3/checks/ to learn more
/**
* This is the main entrypoint to your Probot app
* @param {import('probot').Probot} app
*/
module.exports = (app) => {
app.on("check_suite.completed", async (context) => {
// A check suite has completed!
context.log.info("A check suite has completed!");
context.log.info(context.payload);
});
app.on(["check_suite.requested", "check_run.rerequested"], check);
async function check(context) {
context.log.info("A check suite has been requested!");
context.log.info(context.payload);
const startTime = new Date();
// Do stuff
const { head_branch: headBranch, head_sha: headSha } =
context.payload.check_suite;
// Probot API note: context.repo() => {username: 'hiimbex', repo: 'testing-things'}
return context.octokit.checks.create(
context.repo({
name: "My app!",
head_branch: headBranch,
head_sha: headSha,
status: "completed",
started_at: startTime,
conclusion: "success",
completed_at: new Date(),
output: {
title: "Probot check!",
summary: "The check has passed!",
},
})
);
}
// For more information on building apps:
// https://probot.github.io/docs/
// To get your app running against GitHub, see:
// https://probot.github.io/docs/development/
};