fix: validate webhook trigger type to respect 'On tag' configuration#3711
Open
BENZOOgataga wants to merge 2 commits intoDokploy:canaryfrom
Open
fix: validate webhook trigger type to respect 'On tag' configuration#3711BENZOOgataga wants to merge 2 commits intoDokploy:canaryfrom
BENZOOgataga wants to merge 2 commits intoDokploy:canaryfrom
Conversation
- Add validateTriggerType helper function to validate webhook events against configured trigger type - Support all Git providers: GitHub, GitLab, Gitea, and Bitbucket - Update application deployment endpoint to validate trigger type before processing - Update compose deployment endpoint to validate trigger type before processing - Add comprehensive test suite for trigger type validation - Fixes Dokploy#3710
- Fix logic to reject tag events when triggerType is 'push' - Add test case to verify tags are rejected when triggerType is 'push' - Addresses Greptile bot feedback on PR Dokploy#3711
BENZOOgataga
commented
Feb 16, 2026
Author
BENZOOgataga
left a comment
There was a problem hiding this comment.
I tested the validation logic locally and everything's working as expected.
What I tested
- GitHub, GitLab, Gitea, and Bitbucket webhook validation
- Both "push" and "tag" trigger types
- Made sure events get rejected when they don't match the configured trigger type
- Fixed the Bitbucket issue Greptile pointed out
All tests passed, including the edge cases.
Why no full E2E testing
I couldn't run the full Dokploy stack locally because of version mismatches (Node 20.16.0 required, I have 22.14.0) and webhook testing needs a public URL (ngrok/localtunnel setup).
Instead, I:
- Added comprehensive unit tests in
github.test.ts - Ran standalone tests to verify the validation function works correctly
- Made sure the logic follows the existing codebase patterns
The fix is pretty straightforward, just checking if the webhook event type matches what's configured before deploying. Let me know if you'd like me to adjust anything!
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.
What is this PR about?
This PR fixes an issue where the "On tag" trigger type configuration was being ignored, causing deployments to trigger on regular commits/pushes instead of only on tag events. The fix adds proper validation of webhook events against the configured trigger type for all supported Git providers (GitHub, GitLab, Gitea, and Bitbucket), ensuring that deployments only trigger when the appropriate event type is received.
Changes
Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
closes #3710
Screenshots (if applicable)
N/A - This is a backend webhook validation fix with no UI changes.
Greptile Overview
Greptile Summary
Adds webhook trigger type validation to respect "On tag" configuration for all Git providers (GitHub, GitLab, Gitea, Bitbucket). The
validateTriggerTypehelper correctly validates webhook events against configured trigger types for applications and compose deployments.triggerTypeis "push"Confidence Score: 3/5
(outdated)triggerType: "push"would accept both branch and tag events instead of rejecting tags. This needs to be fixed before merging.Last reviewed commit: 59b52b8
(2/5) Greptile learns from your feedback when you react with thumbs up/down!