-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (43 loc) · 1.2 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Build
on:
push:
branches:
- '*'
- '!main'
pull_request:
branches:
- '*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: latest
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
status:
name: Success build
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [ build ]
steps:
- id: status
name: Load failure jobs count
env:
URL: https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs
USER: admin:${{ secrets.GITHUB_TOKEN }}
FILTER: "[.jobs[] | select(.status==\"completed\" and .conclusion==\"failure\") | { status: .conclusion, matrix: .name}] | length"
run: |
FAILURE_COUNT=$(curl -X GET -s -u $USER $URL | jq "$FILTER")
echo "fails=$FAILURE_COUNT" >> $GITHUB_OUTPUT
echo Failure jobs count: $FAILURE_COUNT
- if: ${{ steps.status.outputs.fails > 0 }}
name: Fail
run: exit 1