Fix github octokit API
This commit is contained in:
parent
6da4caea15
commit
94d3aa4294
2 changed files with 7 additions and 7 deletions
10
index.js
10
index.js
|
@ -4,7 +4,7 @@ const github = require("@actions/github");
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
const accessToken = process.env.GITHUB_TOKEN;
|
const accessToken = process.env.GITHUB_TOKEN;
|
||||||
const octokit = new github.GitHub(accessToken);
|
const octokit = github.getOctokit(accessToken);
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
let newLabelsUrl = path.join(
|
let newLabelsUrl = path.join(
|
||||||
|
@ -39,7 +39,7 @@ async function run() {
|
||||||
};
|
};
|
||||||
console.log(`[Action] Creating Label: ${mod.label.name}`);
|
console.log(`[Action] Creating Label: ${mod.label.name}`);
|
||||||
|
|
||||||
await octokit.issues.createLabel(params);
|
await octokit.rest.issues.createLabel(params);
|
||||||
} else if (mod.type === "update") {
|
} else if (mod.type === "update") {
|
||||||
let params = {
|
let params = {
|
||||||
...github.context.repo,
|
...github.context.repo,
|
||||||
|
@ -49,7 +49,7 @@ async function run() {
|
||||||
};
|
};
|
||||||
console.log(`[Action] Updating Label: ${mod.label.name}`);
|
console.log(`[Action] Updating Label: ${mod.label.name}`);
|
||||||
|
|
||||||
await octokit.issues.updateLabel(params);
|
await octokit.rest.issues.updateLabel(params);
|
||||||
} else if (mod.type === "delete") {
|
} else if (mod.type === "delete") {
|
||||||
if (core.getBooleanInput('delete')) {
|
if (core.getBooleanInput('delete')) {
|
||||||
let params = {
|
let params = {
|
||||||
|
@ -58,14 +58,14 @@ async function run() {
|
||||||
};
|
};
|
||||||
console.log(`[Action] Deleting Label: ${mod.label.name}`);
|
console.log(`[Action] Deleting Label: ${mod.label.name}`);
|
||||||
|
|
||||||
await octokit.issues.deleteLabel(params);
|
await octokit.rest.issues.deleteLabel(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCurrentLabels() {
|
async function getCurrentLabels() {
|
||||||
let response = await octokit.issues.listLabelsForRepo({
|
let response = await octokit.rest.issues.listLabelsForRepo({
|
||||||
...github.context.repo,
|
...github.context.repo,
|
||||||
});
|
});
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue