-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-action.js
38 lines (31 loc) · 1.07 KB
/
github-action.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
const github = require('@actions/github');
const core = require('@actions/core');
const { runAction } = require('./move-stale-issues');
async function run() {
const token = core.getInput('repo-token');
const targetMilestone = core.getInput('target-milestone');
const fromMilestone = core.getInput('from-milestone');
const daysBeforeStale = core.getInput('days-before-stale') || 30;
const exemptAllAssignees = core.getInput('exempt-all-assignees') &&
core.getInput('exempt-all-assignees') !== 'false';
if (!fromMilestone || !targetMilestone || !token) {
throw new Error('repo-token, label-name, target-milestone are required');
}
const config = {
token,
targetMilestone,
exemptAllAssignees,
daysBeforeStale: Number(daysBeforeStale),
fromMilestone: fromMilestone.split(',')
};
const { repo, owner } = github.context.repo;
await runAction(owner, repo, config);
}
(async() => {
try {
await run();
} catch (ex) {
console.error(ex);
process.exit(1);
}
})();