Skip to content

Commit

Permalink
fix: avoid "Error: Not Found" when octokit gives status as string ins…
Browse files Browse the repository at this point in the history
…tead of number (#46)

Minimal fix to get usage unblocked, separate PR for following up on getting deps updated/pinned

Closes #45 

Demo of fix working: https://github.com/dequelabs/dbjorge-test-repo/actions/runs/9603704409/job/26487539207

## Reviewer checks

**Required fields, to be filled out by PR reviewer(s)**

- [x] Follows the commit message policy, appropriate for next version
- [x] Code is reviewed for security
  • Loading branch information
dbjorge authored Jun 20, 2024
1 parent afa6750 commit 5395589
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ async function run(): Promise<void> {
})
pullRequestTemplate = response.data
} catch (err) {
if (err.status === 404 && err.message === 'Not Found') {
// Careful; `err.status` can be either a string or a number depending on
// octokit version.
if (
String(err.status) === '404' &&
err.message === 'Not Found'
) {
console.log(
`Unable to find pr-template "${template}"`
)
Expand Down

0 comments on commit 5395589

Please sign in to comment.