Skip to content

Commit

Permalink
jenkins: parse PR number into a number while extracting from git ref
Browse files Browse the repository at this point in the history
Primarily done because the GraphQL client validation done when fetching
existing bot comments, exploded because an invalid `Int!` value was
provided:

```
00:42:03.038Z ERROR bot: Error while creating comment on GitHub (req_id=baae5340-8be1-11e9-a4d0-856e0a231c31)
    GraphqlError: Variable number of type Int! was provided invalid value
        at request.then.response (/home/../node_modules/@octokit/graphql/lib/graphql.js:31:15)
```

Doing an explicit `string -> number` convertion when extracting the
PR number from the related git ref hopefully fixes this error, since it
*should* be a valid `Int!` now.
  • Loading branch information
phillipj committed Jun 11, 2019
1 parent 98f7322 commit 2488a2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/push-jenkins-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function pushEnded (options, build, cb) {

function findPrInRef (gitRef) {
// refs/pull/12345/head
return gitRef.split('/')[2]
return parseInt(gitRef.split('/')[2], 10)
}

function findLatestCommitInPr (options, cb, pageNumber = 1) {
Expand Down

0 comments on commit 2488a2b

Please sign in to comment.