Skip to content

Commit 5ddf0f7

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

3 files changed

Lines changed: 9 additions & 15 deletions

File tree

__tests__/labeler.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fs from 'fs';
22
import nock from 'nock';
3-
import {OctokitOptions} from '@octokit/core/dist-types/types';
43
import {Inputs} from '../src/context';
54
import {Labeler, LabelStatus} from '../src/labeler';
65

@@ -75,11 +74,6 @@ const cases = [
7574

7675
const orginalGitHubRepo = process.env.GITHUB_REPOSITORY;
7776

78-
const octokitOptions = {
79-
retry: {enabled: false},
80-
throttle: {enabled: false}
81-
} as OctokitOptions;
82-
8377
describe('run', () => {
8478
beforeAll(() => {
8579
process.env.GITHUB_REPOSITORY = 'crazy-max/ghaction-github-labeler';
@@ -101,7 +95,7 @@ describe('run', () => {
10195
.get(`/repos/crazy-max/ghaction-github-labeler/contents/${encodeURIComponent(input.yamlFile as string)}`)
10296
.reply(200, configFixture(input.yamlFile as string));
10397

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

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

dist/index.js

Lines changed: 3 additions & 3 deletions
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)