Skip to content

Commit 427ea8b

Browse files
it works!
1 parent 0098bd4 commit 427ea8b

File tree

10 files changed

+48053
-54195
lines changed

10 files changed

+48053
-54195
lines changed

auto-label/dist/index.js

Lines changed: 7560 additions & 8731 deletions
Large diffs are not rendered by default.

auto-label/src/ensure-label.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ import { getOctokit } from '@actions/github';
33

44
type GitHub = ReturnType<typeof getOctokit>;
55

6-
export async function addPullRequestLabel(github: GitHub, request: { owner: string; repo: string }, pr: Awaited<ReturnType<GitHub['pulls']['get']>>['data']) {
6+
export async function addPullRequestLabel(
7+
github: GitHub,
8+
request: { owner: string; repo: string },
9+
pr: Awaited<ReturnType<GitHub['rest']['pulls']['get']>>['data'],
10+
) {
711
console.log(`pr title: ${pr.title}`);
812
const title = pr.title.split(':')[0].trim();
9-
var labelsForRepository = await github.issues.listLabelsForRepo({ ...request });
13+
var labelsForRepository = await github.rest.issues.listLabelsForRepo({ ...request });
1014
const titleLabel = labelsForRepository.data.filter(z => z.name.includes(title)).map(x => x.name);
1115
const hasLabel = titleLabel.length > 0;
1216

1317
console.log(`label ${hasLabel ? 'found' : 'not found'}`, pr.labels);
1418
if (!hasLabel) return;
1519

1620
console.log('adding title label', titleLabel);
17-
await github.issues.addLabels({
21+
await github.rest.issues.addLabels({
1822
...request,
1923
issue_number: pr.number,
2024
labels: titleLabel,

auto-label/src/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function run(): Promise<void> {
99
const github = getOctokit(githubToken, {});
1010

1111
if (payload.pull_request) {
12-
const pr = await github.pulls.get({
12+
const pr = await github.rest.pulls.get({
1313
...repo,
1414
pull_number: payload.pull_request.number,
1515
});
@@ -18,6 +18,7 @@ async function run(): Promise<void> {
1818
await addPullRequestLabel(github, repo, pr.data);
1919
}
2020
}
21+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2122
} catch (error: any) {
2223
setFailed(error.message);
2324
}

0 commit comments

Comments
 (0)