-
Notifications
You must be signed in to change notification settings - Fork 65
59 lines (50 loc) · 1.47 KB
/
validate.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
name: Validate PR
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
validate:
name: validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
with:
dir_names: true
files: |
data/**
- name: List all changed tokens
id: changed_tokens
run: |
tokens=""
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
token=$(echo -e "$file" | sed -nr "s|^data/([^/]*/?).*|\1|p")
tokens+="${token},"
done
echo "changed tokens: ${tokens%,*}"
echo "result=${tokens%,*}" >> $GITHUB_OUTPUT
- name: yarn install
if: ${{ steps.changed_tokens.outputs.result != '' }}
run: |
yarn install --frozen-lockfile
- name: Validate token list
if: ${{ steps.changed_tokens.outputs.result != '' }}
run: |
yarn validate ${{ steps.changed_tokens.outputs.result }} 2> err.txt 1> std.txt
- name: Print validation output
if: ${{ always() && steps.changed_tokens.outputs.result != '' }}
run: |
echo '=== std.txt ==='
cat std.txt
echo '=== err.txt ==='
cat err.txt