diff --git a/lib/getPullRequestLabel.js b/lib/getPullRequestLabel.js index 0959d13e..4dfbcc15 100644 --- a/lib/getPullRequestLabel.js +++ b/lib/getPullRequestLabel.js @@ -3,7 +3,7 @@ async function getPullRequestLabel(githubRepo, validLabels, pullRequestId, { git const [ owner, repo ] = githubRepo.split('/'); const params = { owner, repo, number: pullRequestId }; - const { data: labels } = await githubClient.issues.getIssueLabels(params); + const { data: labels } = await githubClient.issues.listLabelsOnIssue(params); const listOfLabels = validLabelNames.join(', '); const filteredLabels = labels.filter((label) => { diff --git a/test/unit/lib/getPullRequestLabelSpec.js b/test/unit/lib/getPullRequestLabelSpec.js index 973f4cbe..c771ff0a 100644 --- a/test/unit/lib/getPullRequestLabelSpec.js +++ b/test/unit/lib/getPullRequestLabelSpec.js @@ -6,7 +6,7 @@ import defaultValidLabels from '../../../lib/validLabels'; function createGithubClient(labels = []) { return { issues: { - getIssueLabels: sinon.stub().resolves({ data: labels }) + listLabelsOnIssue: sinon.stub().resolves({ data: labels }) } }; } @@ -19,8 +19,8 @@ test('requests the labels for the correct repo and pull request', async (t) => { await getPullRequestLabel(anyRepo, defaultValidLabels, anyPullRequestId, { githubClient }); - t.is(githubClient.issues.getIssueLabels.callCount, 1); - t.deepEqual(githubClient.issues.getIssueLabels.firstCall.args, [ + t.is(githubClient.issues.listLabelsOnIssue.callCount, 1); + t.deepEqual(githubClient.issues.listLabelsOnIssue.firstCall.args, [ { owner: 'any', repo: 'repo', number: 123 } ]); });