Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds a GitHub Actions workflow to automatically deploy preview environments for pull requests. When a PR is opened or updated, the workflow SSHs into a server and deploys the website to a preview environment using PM2. Critical Issues:
Recommendations:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant GH as GitHub Actions
participant SSH as SSH Connection
participant Server as Deploy Server
participant Git as Git Repository
participant PM2 as PM2 Process Manager
GH->>SSH: Connect via appleboy/ssh-action
SSH->>Server: Execute deployment script
Server->>Server: Load NVM environment
alt Directory doesn't exist
Server->>Git: git clone repository
end
Server->>Git: git fetch origin
Server->>Server: git checkout branch
Server->>Server: git reset --hard origin/branch
Server->>Server: cd website
Server->>Server: pnpm install --frozen-lockfile
Server->>Server: pnpm run build
Server->>PM2: pm2 delete old app (if exists)
Server->>PM2: pm2 start new app on PORT 3001
Server->>PM2: pm2 save
SSH-->>GH: Deployment complete
Last reviewed commit: 0f858f4 |
| concurrency: | ||
| group: deploy-preview | ||
| cancel-in-progress: true |
There was a problem hiding this comment.
Concurrency group should include PR number to prevent different PRs from canceling each other's deployments
| concurrency: | |
| group: deploy-preview | |
| cancel-in-progress: true | |
| concurrency: | |
| group: deploy-preview-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true |
.github/workflows/deploy.yml
Outdated
| DEPLOY_DIR=/opt/loglife/preview | ||
| APP_NAME=loglife-preview | ||
| PORT=3001 |
There was a problem hiding this comment.
All PRs share the same deploy directory, port, and app name, causing conflicts when multiple PRs are open
| DEPLOY_DIR=/opt/loglife/preview | |
| APP_NAME=loglife-preview | |
| PORT=3001 | |
| DEPLOY_DIR=/opt/loglife/preview-${{ github.event.pull_request.number }} | |
| APP_NAME=loglife-preview-${{ github.event.pull_request.number }} | |
| PORT=$((3000 + ${{ github.event.pull_request.number }})) |
| cd "$DEPLOY_DIR" | ||
| git fetch origin | ||
| git checkout "$BRANCH" | ||
| git reset --hard "origin/$BRANCH" |
There was a problem hiding this comment.
git reset --hard will discard any uncommitted changes or failed deployment artifacts without verification
| pnpm install --frozen-lockfile | ||
| pnpm run build |
There was a problem hiding this comment.
Add error handling to prevent starting the server if build fails - consider adding set -e at the start of the script
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
No description provided.