-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (46 loc) · 1.41 KB
/
template-ci.yaml
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
name: "Template-CI"
on:
pull_request:
types:
- opened
- edited
- synchronize
schedule:
- cron: "0 8 * * *"
jobs:
check-format:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup node
uses: actions/[email protected]
with:
node-version: 14
- name: Setup project
run: |
npm ci
working-directory: ./src
- name: templates check
run: |
npm run generate:all
working-directory: ./src
- name: Check if there are changes
id: changes
run: |
git add .
VAR=$(git diff --cached --name-only)
if [ ! -z "$VAR" ]
then
echo $VAR
echo '======================================= Prompt Information ==============================================='
echo 'There may be some unformatted files in your PR, please run these commands on Git Bash terminal: '
echo '1. npm run generate:all'
echo 'please replace the ${your-PR-target-branch} as the target branch of your PR, such as origin/dev or upstream/dev'
exit 1
fi