From 898adbce5c3ae8e0fa9f8b57c1c4da0733a52ced Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 24 Jul 2019 12:23:40 -0500 Subject: [PATCH] fix: "TypeError: fn is not a function" crash in release notes generator (#19394) * fix: fix cache filename of issue comments * fix: update octokit deprecated API use * fix: "TypeError: fn is not a function" in notes.js * chore: retryableFunc does not need to be async * chore: simplify checkCache() operation param --- script/release/notes/notes.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/script/release/notes/notes.js b/script/release/notes/notes.js index 98f07958453e..7f187c5c2a72 100644 --- a/script/release/notes/notes.js +++ b/script/release/notes/notes.js @@ -319,25 +319,14 @@ async function runRetryable (fn, maxRetries) { const getPullRequest = async (number, owner, repo) => { const name = `${owner}-${repo}-pull-${number}` - return checkCache(name, async () => { - return runRetryable(octokit.pulls.get({ - number, - owner, - repo - }), MAX_FAIL_COUNT) - }) + const retryableFunc = () => octokit.pulls.get({ pull_number: number, owner, repo }) + return checkCache(name, () => runRetryable(retryableFunc, MAX_FAIL_COUNT)) } const getComments = async (number, owner, repo) => { - const name = `${owner}-${repo}-pull-${number}-comments` - return checkCache(name, async () => { - return runRetryable(octokit.issues.listComments({ - number, - owner, - repo, - per_page: 100 - }), MAX_FAIL_COUNT) - }) + const name = `${owner}-${repo}-issue-${number}-comments` + const retryableFunc = () => octokit.issues.listComments({ issue_number: number, owner, repo, per_page: 100 }) + return checkCache(name, () => runRetryable(retryableFunc, MAX_FAIL_COUNT)) } const addRepoToPool = async (pool, repo, from, to) => {