-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (32 loc) · 946 Bytes
/
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
import { Octokit } from "octokit";
const core = require("@actions/core");
const github = require("@actions/github");
const organization = 'Mind-Sports-Games'
const username = core.getInput("username", { required: true });
const token = core.getInput("token", { required: true });
const octokit = new Octokit({
auth: token
});
main();
async function main() {
try {
await octokit.request('GET /orgs/{org}/members/{username}', {
org: organization,
username: username,
headers: {
'X-GitHub-Api-Version': '2022-11-28',
'Accept': 'application/vnd.github+json'
}
});
core.setOutput("result", "true");
} catch (error) {
if (error.status === 302) {
core.setOutput("result", "false");
} else if (error.status === 404){
core.setOutput("result", "false");
} else {
core.setFailed(`Received status ${error.status} from API.`);
process.exit();
}
};
}