feat: add support for 'labeled' action in GitHub deployment handler#3960
Merged
Siumauricio merged 1 commit intocanaryfrom Mar 10, 2026
Conversation
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?
Please describe in a short paragraph what this PR is about.
Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
closes #3956
Screenshots (if applicable)
Greptile Summary
This PR adds
"labeled"to theshouldCreateDeploymentcondition in the GitHub webhook handler, enabling preview deployments to be created (not just re-triggered) when a label is added to a pull request.Key changes:
action === "labeled"is now included in theshouldCreateDeploymentboolean, which gates thecreatePreviewDeploymentcall at line 484previewLabels(e.g.,["deploy-preview"]): previously, if a PR was opened without the required label, no preview deployment was created; when the label was later added,shouldCreateDeploymentwasfalse, so no new deployment was ever created — the label-based trigger was silently a no-op for net-new deploymentsapp.previewLabelsvspull_request.labels) correctly evaluates the post-label state, so only apps whose configured labels match the PR's current label set proceed to deploymentMinor behavioural side-effect to be aware of: For apps that have no
previewLabelsconfigured (i.e., they deploy on all PR events), adding any label to a PR could now create a new preview deployment if one does not already exist for that PR. In practice this is harmless — if such an app is configured to react to all PR events it will already have a preview deployment from theopenedevent, sofindPreviewDeploymentByApplicationIdwill return the existing record and no new deployment is created; the existing one is simply re-queued.Confidence Score: 5/5
labeledaction with no new code paths introduced. The fix correctly addresses the root cause reported in Preview deployments with previewLabels fail due to webhook race condition #3956.Last reviewed commit: e554adc