-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathindex.js
More file actions
18 lines (16 loc) · 660 Bytes
/
index.js
File metadata and controls
18 lines (16 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const { Octokit } = require("@octokit/action");
const payload = require(process.env.GITHUB_EVENT_PATH);
const isWip = /\bwip\b/i.test(payload.pull_request.title);
const octokit = new Octokit();
// https://developer.github.com/v3/repos/statuses/#create-a-status
octokit
.request("POST /repos/:owner/:repo/statuses/:sha", {
owner: payload.repository.owner.login,
repo: payload.repository.name,
sha: payload.pull_request.head.sha,
state: isWip ? "pending" : "success",
target_url: "https://github.com/wip/action",
description: isWip ? "work in progress" : "ready for review",
context: "WIP (action)",
})
.catch(console.error);