Fix webhook 404s and changelog check crashes - #118
Merged
Merged
Conversation
Set the path the app listens on
changedFiles used context.issue() (issue_number) instead of context.pullRequest() (pull_number), so pulls.listFiles never had a valid pull_number. setStatus called the now-renamed repos.createStatus (createCommitStatus). The internal log() helper called robot.log directly, but pino loggers require a level method (robot.log.info). All three were unreachable until the prior commit fixed the context.config() crash that always ran first, so none of this had ever executed successfully. Adds test/changelog.test.js since this file had zero coverage. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores correct operation of the Probot-based webhook app after a long gap in deployments by fixing webhook routing/config loading and updating the changelog status check to use current Probot/Octokit APIs, plus adding a new Jest test to cover the changelog check behavior.
Changes:
- Add
WEBHOOK_PATH=/to prevent webhook 404s after Probot’s default webhook path change. - Replace
probot-configusage with Probot’s built-incontext.config()and update Octokit method usage (createCommitStatus,context.pullRequest()). - Add a Jest test (
test/changelog.test.js) to exercise the changelog status logic and prevent regressions.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app.json | Adds WEBHOOK_PATH env var default to keep GitHub App webhook URL compatible. |
| package.json | Removes probot-config dependency now that context.config() is used. |
| yarn.lock | Drops transitive dependencies that were only required by probot-config. |
| src/changelog.js | Updates config loading, PR file listing, commit status API call, and logger invocation for current Probot/Octokit. |
| test/changelog.test.js | Adds coverage for changelog status behavior on pull_request events using nock. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bethshook
approved these changes
Jul 30, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
staxlyhadn't been redeployed to Heroku in ~2 years. This PR's first two commits (already on this branch) fixed the deploy-blocking issue; this commit fixes what that unmasked:/to/api/github/webhooks. GitHub's webhook URL for this app is still configured for/, so every webhook POST 404'd after the upgrade. AddedWEBHOOK_PATH=/toapp.json(both as a live fix and so future deploys/Review Apps don't regress).context.config()instead ofprobot-config: the abandonedprobot-configdependency calledcontext.github.repos.getContents(...), butcontext.githubwas renamed tocontext.octokitback in 2021. Replaced with Probot's built-incontext.config()and dropped the dependency.context.pullRequest()instead ofcontext.issue():changedFileswas buildingpulls.listFilesparams fromcontext.issue()(issue_number), but that endpoint needspull_number. Verified the fix produces the correct request URL.createCommitStatusinstead ofcreateStatus:repos.createStatuswas renamed in current Octokit.robot.log.info(...)instead ofrobot.log(...): pino loggers aren't callable directly — this call has apparently never succeeded.None of the last four bugs were introduced by this PR — they'd all been present since 2021, each one masking the next, invisible because
changelog.jshas never had any test coverage (/* istanbul ignore file */, no test file). This PR addstest/changelog.test.jsto close that gap.Heads up
staxly's own.github/config.ymlrequires aREADME.mdupdate for any PR touchingsrc/(via this same changelog check) — a convention that hasn't actually been followed since 2023. So this PR will likely showchangelog: pendingon itself once the check is live again. That's expected and non-blocking (it's an informational status, not a required check) — decided not to address it in this PR; tracking it in a follow-up issue instead.Test plan
yarn jest --coverage— all suites passstandard --fix— clean/with no more 404s in Heroku logspull_requestevent produces achangelogstatus instead of an error in the logs🤖 Generated with Claude Code