diff --git a/badges/coverage.svg b/badges/coverage.svg index 6896a81..9ddddde 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 41.37%Coverage41.37% \ No newline at end of file +Coverage: 42.85%Coverage42.85% \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 125fd85..0902128 100644 --- a/dist/index.js +++ b/dist/index.js @@ -10437,15 +10437,15 @@ async function run() { } core.debug(`github.context: ${JSON.stringify(github.context)}`); const pullRequest = github.context.payload.pull_request; - const [_scheme, _blank, _domain, owner, repo, _path, numberString] = // eslint-disable-line @typescript-eslint/no-unused-vars + // Parses a URL that looks like: https://api.github.com/repos/lerebear/sizeup/pulls/1 + const [_scheme, _blank, _domain, _route, owner, repo, _subRoute, number] = // eslint-disable-line @typescript-eslint/no-unused-vars pullRequest.url.split('/'); - const number = Number.parseInt(numberString, 10); core.debug(`pull request: ${owner}/${repo}#${number}`); const octokit = github.getOctokit(core.getInput('token')); const diff = (await octokit.rest.pulls.get({ owner, repo, - pull_number: number, + pull_number: Number.parseInt(number, 10), mediaType: { format: 'diff' } })).data; const score = sizeup_1.default.evaluate(diff, config); diff --git a/src/main.ts b/src/main.ts index b2b664c..5c43755 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,9 +29,9 @@ export async function run(): Promise { core.debug(`github.context: ${JSON.stringify(github.context)}`) const pullRequest = github.context.payload.pull_request as PullRequest - const [_scheme, _blank, _domain, owner, repo, _path, numberString] = // eslint-disable-line @typescript-eslint/no-unused-vars + // Parses a URL that looks like: https://api.github.com/repos/lerebear/sizeup/pulls/1 + const [_scheme, _blank, _domain, _route, owner, repo, _subRoute, number] = // eslint-disable-line @typescript-eslint/no-unused-vars pullRequest.url.split('/') - const number = Number.parseInt(numberString, 10) core.debug(`pull request: ${owner}/${repo}#${number}`) const octokit = github.getOctokit(core.getInput('token')) @@ -39,7 +39,7 @@ export async function run(): Promise { await octokit.rest.pulls.get({ owner, repo, - pull_number: number, + pull_number: Number.parseInt(number, 10), mediaType: { format: 'diff' } }) ).data as unknown as string