fix: recreate the Forgejo webhooks instead of editing them #34

Merged
Gilles merged 1 commit from fix/recreate-forgejo-webhooks into master 2026-11-01 14:33:01 +00:00
Owner

Closes #33 (follow-up of #31/#32).

Forgejo's editHook only applies url and content_type from config — never secret (only addHook reads it) — so the PATCH in resend_forgejo_webhooks left the hooks without a secret, and deliveries are still refused.

  • apps.specs.forgejo.recreate_webhook(hook) (replaces resend_webhook_config): creates a new hook with a fresh secret inside config, saves its id and secret on the row, then deletes the old hook (a failed delete is only logged: the old hook's deliveries are refused anyway). A failed creation leaves the row untouched.
  • manage.py resend_forgejo_webhooks now recreates each hook; still harmless to run again.

Test plan

  • manage.py test — 206 tests OK (the 2 command tests rewritten: create with the new secret then delete the old hook; a failed creation keeps the row and the next repo is still done)
  • autopep8 --diff clean, bandit 0 issues
  • After deploy: docker exec thierryade python manage.py resend_forgejo_webhooks, then a Forgejo test delivery is accepted

🤖 Generated with Claude Code

https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA

Closes #33 (follow-up of #31/#32). Forgejo's `editHook` only applies `url` and `content_type` from `config` — never `secret` (only `addHook` reads it) — so the PATCH in `resend_forgejo_webhooks` left the hooks without a secret, and deliveries are still refused. - `apps.specs.forgejo.recreate_webhook(hook)` (replaces `resend_webhook_config`): creates a new hook with a fresh secret inside `config`, saves its id and secret on the row, then deletes the old hook (a failed delete is only logged: the old hook's deliveries are refused anyway). A failed creation leaves the row untouched. - `manage.py resend_forgejo_webhooks` now recreates each hook; still harmless to run again. ## Test plan - [x] `manage.py test` — 206 tests OK (the 2 command tests rewritten: create with the new secret then delete the old hook; a failed creation keeps the row and the next repo is still done) - [x] `autopep8 --diff` clean, `bandit` 0 issues - [ ] After deploy: `docker exec thierryade python manage.py resend_forgejo_webhooks`, then a Forgejo test delivery is accepted 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
fix: recreate the Forgejo webhooks instead of editing them
All checks were successful
ci / test (pull_request) Successful in 3m40s
ci / e2e (pull_request) Has been skipped
ci / docker (pull_request) Has been skipped
ci / deploy (pull_request) Has been skipped
ca644ecc01
Forgejo's edit-hook API never reads config["secret"] (only creation
does), so resend_forgejo_webhooks changed nothing. recreate_webhook now
creates a new hook with a fresh secret, updates the row, then deletes
the old hook; the command uses it.

Closes #33.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
Author
Owner
<!-- argus-link-bot:thierryade/backend --> 📊 [Rapports Argus pour cette PR](https://reports.stationmyr.net/thierryade/backend/pr/34)
Gilles merged commit 02f1177646 into master 2026-11-01 14:33:01 +00:00
Gilles deleted branch fix/recreate-forgejo-webhooks 2026-11-01 14:33:01 +00:00
Sign in to join this conversation.
No description provided.