title change event reaction kind of works, taking a lunch break #147
This file contains 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
name: CI/CD Pipeline | |
on: | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
# Add a check for linting | |
- name: Lint Code | |
run: npm run lint | |
env: | |
CI: true | |
- name: Create dummy amplify_outputs.json file | |
run: echo "{}" > amplify_outputs.json | |
- name: Run build | |
run: npm run build | |
- name: Post success message | |
if: success() | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const branchName = context.payload.pull_request.head.ref; | |
const previewUrl = `https://${branchName}.d3c5lsis3camij.amplifyapp.com/`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Build check completed! View branch preview here: ${previewUrl}. Please allow 10-15 minutes for the preview to be deployed. Deployment errors will not be shown here.` | |
}) | |