Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

update trigger.dev ci to only push to staging on merge to staging & for prod as well

Type of Change

  • Bug fix

Testing

Added provision to make deployment to trigger only happen on merges to the branches, not when PRs were made against branches

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Oct 1, 2025 8:07pm
sim Ready Ready Preview Comment Oct 1, 2025 8:07pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR fixes an issue in the Trigger.dev deployment workflow where deployments could be triggered during pull request events instead of only on actual merges to target branches. The change adds `github.event_name == 'push'` conditions to both staging and production deployment steps in the `trigger-deploy.yml` workflow file.

The modification ensures that Trigger.dev deployments only occur when code is actually pushed/merged to the staging or main branches, not when pull requests are opened against these branches. This aligns the individual deployment step conditions with the existing job-level conditions already present in the main CI workflow (ci.yml), creating a more defensive and consistent deployment strategy.

The change integrates well with the existing CI architecture, which already has similar protections at the job level. By adding these conditions at the step level, it provides an additional layer of safety to prevent accidental deployments during the PR review process.

Changed Files
Filename Score Overview
.github/workflows/trigger-deploy.yml 5/5 Added event type checks to deployment conditions to prevent deployments on PR events

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it adds defensive conditions to prevent unintended deployments
  • Score reflects the simple, well-targeted nature of the fix that addresses a clear gap in deployment logic
  • No files require special attention as the change is straightforward and follows existing patterns

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub
    participant CI as CI Workflow
    participant TD as Trigger.dev

    Dev->>GH: "Push to staging branch"
    GH->>CI: "Trigger workflow_call"
    CI->>CI: "Check: github.event_name == 'push'"
    CI->>CI: "Check: github.ref == 'refs/heads/staging'"
    CI->>CI: "Setup Node & Bun environment"
    CI->>CI: "Install dependencies (bun install)"
    CI->>TD: "Deploy to staging environment"
    TD-->>CI: "Staging deployment complete"

    Note over Dev,TD: Alternative flow for main branch

    Dev->>GH: "Push to main branch"
    GH->>CI: "Trigger workflow_call"
    CI->>CI: "Check: github.event_name == 'push'"
    CI->>CI: "Check: github.ref == 'refs/heads/main'"
    CI->>CI: "Setup Node & Bun environment"
    CI->>CI: "Install dependencies (bun install)"
    CI->>TD: "Deploy to production environment"
    TD-->>CI: "Production deployment complete"
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 896f7bb into staging Oct 1, 2025
10 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/trigger-ci branch October 1, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants