-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (30 loc) · 981 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
const core = require("@actions/core");
const github = require("@actions/github");
async function run() {
try {
const context = github.context;
const token = core.getInput('token', {required: true});
const description = core.getInput('description', {required: false});
const environment = core.getInput('environment', {required: false});
const payload = core.getInput('payload', {required: false});
const refId = core.getInput('ref-id', {required: true});
const task = core.getInput('task', {required: false});
const client = new github.GitHub(token);
const params = {
...context.repo,
auto_merge: true,
description,
environment,
payload,
ref: refId,
required_contexts: [],
task,
};
// https://developer.github.com/v4/mutation/createdeployment/
await client.repos.createDeployment(params);
} catch (error) {
core.error(error);
core.setFailed(error.message);
}
}
run();