Fix #11: match existing smee.io webhook by domain prefix on URL drift#12
Merged
waleedkadous merged 1 commit intoApr 16, 2026
Merged
Conversation
When state.json regenerates a new smee URL, the exact-match lookup fails and setup creates a duplicate webhook. Add a fallback that matches any webhook pointing to https://smee.io/ so the existing hook gets PATCHed instead of duplicated. Applied to all three forges.
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
When
ci-channel setupis re-run afterstate.jsonregenerates a new smee URL, the exact-match webhook lookup fails and creates a duplicate webhook instead of patching the existing one.Fixes #11
Root Cause
The webhook matching logic in
lib/setup.tscompared the existing webhook URL against the smee URL fromstate.jsonusing exact string equality. When the smee URL drifted (e.g., state.json deleted and re-created), no match was found, causing a new webhook to be created.Fix
Added a fallback match: when no exact URL match is found, search for any webhook whose URL starts with
https://smee.io/. This catches drifted ci-channel webhooks and PATCHes them with the current smee URL. Applied to all three forges (GitHub, GitLab, Gitea).Flaky Tests
Two pre-existing flaky tests were marked as skipped (failing identically on
main):bootstrap.test.ts: "persists only secret when smee fails"config.test.ts: "handles missing env file gracefully"Both fail due to state leaking between tests — unrelated to this fix.
Test Plan