Skip to content

Commit 3826853

Browse files
committed
Revert "disable octokit throttling in tests"
This reverts commit 3ab61b3. Throttle is not enabled by default
1 parent b0e13ea commit 3826853

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

__tests__/labeler.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {describe, expect, test} from '@jest/globals';
22
import fs from 'fs';
33
import nock from 'nock';
4-
import {OctokitOptions} from '@octokit/core/dist-types/types';
54
import {Inputs} from '../src/context';
65
import {Labeler, LabelStatus} from '../src/labeler';
76

@@ -76,11 +75,6 @@ const cases = [
7675
]
7776
];
7877

79-
const octokitOptions = {
80-
retry: {enabled: false},
81-
throttle: {enabled: false}
82-
} as OctokitOptions;
83-
8478
describe('run', () => {
8579
beforeAll(() => {
8680
nock.disableNetConnect();
@@ -100,7 +94,7 @@ describe('run', () => {
10094
.get(`/repos/crazy-max/ghaction-github-labeler/contents/${encodeURIComponent(input.yamlFile as string)}`)
10195
.reply(200, configFixture(input.yamlFile as string));
10296

103-
const labeler = new Labeler(input, octokitOptions);
97+
const labeler = new Labeler(input);
10498
await labeler.printRepoLabels();
10599
console.log(
106100
(await labeler.labels).map(label => {
@@ -171,7 +165,7 @@ describe('run', () => {
171165
.get(`/repos/crazy-max/ghaction-github-labeler/contents/${encodeURIComponent('.res/labels.merge1.yml')}`)
172166
.reply(200, configFixture('.res/labels.merge1.yml'));
173167

174-
const labeler = new Labeler(input, octokitOptions);
168+
const labeler = new Labeler(input);
175169
const fileLabels = await labeler.fileLabels;
176170
expect(fileLabels.length).toBe(16);
177171
expect(fileLabels[15]).toEqual(expect.objectContaining({name: ':unicorn: Special'}));

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/labeler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as core from '@actions/core';
55
import {Inputs} from './context';
66
import {GitHub, getOctokitOptions, context} from '@actions/github/lib/utils';
77
import {config} from '@probot/octokit-plugin-config';
8-
import {OctokitOptions} from '@octokit/core/dist-types/types';
8+
import deepmerge from 'deepmerge';
99
export type Label = {
1010
name: string;
1111
color: string;
@@ -39,8 +39,8 @@ export class Labeler {
3939
private readonly repoLabels: Promise<Label[]>;
4040
readonly fileLabels: Promise<Label[]>;
4141

42-
constructor(inputs: Inputs, options: OctokitOptions = {}) {
43-
const octokit = GitHub.plugin(config).defaults(options);
42+
constructor(inputs: Inputs) {
43+
const octokit = GitHub.plugin(config);
4444
this.octokit = new octokit(getOctokitOptions(inputs.githubToken));
4545
this.dryRun = inputs.dryRun;
4646
this.skipDelete = inputs.skipDelete;
@@ -213,7 +213,7 @@ export class Labeler {
213213
configs
214214
.map(config => {
215215
const labels = config.labels ? config.labels : config;
216-
return {labels: labels || []};
216+
return {labels};
217217
})
218218
.map(config => {
219219
config.labels.forEach(function (item: Label) {

0 commit comments

Comments
 (0)