error-handlingmediumQuestion 45 of 70
Staging Deployment Pipeline
Review the following YAML workflow code and flag the issue.
YAML
1name: Deploy to Staging
2
3on:
4 push:
5 branches: [main]
6
7jobs:
8 test:
9 runs-on: ubuntu-latest
10 steps:
11 - uses: actions/checkout@v4
12
13 - name: Setup Node.js
14 uses: actions/setup-node@v4
15 with:
16 node-version: '20'
17 cache: 'npm'
18
19 - name: Install dependencies
20 run: npm ci
21
22 - name: Run tests
23 continue-on-error: true
24 run: npm test
25
26 deploy:
27 needs: test
28 runs-on: ubuntu-latest
29 steps:
30 - uses: actions/checkout@v4
31
32 - name: Deploy to staging
33 env:
34 DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
35 run: |
36 curl -X POST https://api.staging.example.com/deploy \
37 -H "Authorization: Bearer $DEPLOY_TOKEN" \
38 -d '{"ref": "main"}'