-
-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (59 loc) · 1.81 KB
/
test.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
coverage-badge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: shellcheck
uses: reviewdog/[email protected]
- uses: actions/[email protected]
with:
node-version: 20.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/[email protected]
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
working-directory: test-app
- name: Run test
run: yarn test --coverage
working-directory: test-app
- name: Run coverage badge js
uses: ./
with:
path: test-app
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
files: |
test-app/coverage/badge.svg
- name: Coverage badge has changed
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
echo "test-app/coverage/badge.svg has uncommited changes"
exit 1
- name: Create Pull Request
if: failure()
uses: peter-evans/create-pull-request@v7
with:
base: "main"
title: "Updated coverage badge"
branch: "chore/update-coverage-badge"
commit-message: "Updated coverage badge."
body: "Updated coverage badge."
token: ${{ secrets.PAT_TOKEN }}