Hey everyone! 👋 I'm currently setting up a Bitbucket pipeline for my Node.js project and would love to hear your thoughts on my `bitbucket-pipelines.yml` file. It triggers on pull requests and involves steps like installing dependencies, performing ESLint and formatting checks, validating commit messages, and building the app. Does my configuration look good? Are there any improvements or best practices I might be overlooking? I really appreciate any tips! 🙏
```yaml
image: node:22
options:
size: 2x
pipelines:
pull-requests:
"**":
- step:
name: Install Dependencies
caches:
- node
script:
- echo "Installing dependencies..."
- npm ci
- echo "Dependencies installed successfully!"
artifacts:
- node_modules/**
- parallel:
- step:
name: Code Quality Checks
script:
- echo "Running ESLint..."
- npm run eslint
- echo "Checking code formatting..."
- npm run format:check
- step:
name: Validate Commit Messages
script:
- echo "Validating commit messages in PR..."
- npm run commitlint -- --from origin/$BITBUCKET_PR_DESTINATION_BRANCH --to HEAD --verbose
- step:
name: Build Application
script:
- echo "Building production application..."
- npm run buildProd
```
2 Answers
I'm curious why you wouldn't want to build on PRs. In my experience, building on every PR has been standard practice across the various projects I've worked on. It helps catch issues that might not show up in other checks. Your project probably only takes a few seconds to build anyway, so it could be worth it!
I wouldn’t recommend building on every pull request; it’s better to only build on PRs to main/master. Other than that, your YAML looks fine! You might want to consider adding code and secret scanning tools like Trivy, just for extra security.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically