Skip to content

Commit

Permalink
Fix pull request url parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lerebear committed Sep 29, 2023
1 parent 42e74ad commit 911cb2e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ export async function run(): Promise<void> {
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'))
const diff = (
await octokit.rest.pulls.get({
owner,
repo,
pull_number: number,
pull_number: Number.parseInt(number, 10),
mediaType: { format: 'diff' }
})
).data as unknown as string
Expand Down

0 comments on commit 911cb2e

Please sign in to comment.