-
Notifications
You must be signed in to change notification settings - Fork 667
77 lines (64 loc) · 1.97 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Validate PR
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
validate:
name: validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8.6.0
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Save PR number
run: echo ${{ github.event.number }} > pr.txt
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
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 "result=${tokens%,*}" >> $GITHUB_OUTPUT
- name: Validate token list
if: ${{ steps.changed_tokens.outputs.result != '' }}
run: |
pnpm validate --datadir ./data --tokens "${{ steps.changed_tokens.outputs.result }}" 2> err.txt 1> std.txt
- name: Print output
if: ${{ always() && steps.changed_tokens.outputs.result != '' }}
run: |
cat std.txt; cat err.txt
- name: Upload artifacts
if: ${{ always() && steps.changed_tokens.outputs.result != '' }}
uses: actions/upload-artifact@v3
with:
name: logs-artifact
path: |
pr.txt
err.txt
std.txt
- name: Upload validation results
if: ${{ always() && steps.changed_tokens.outputs.result != '' }}
uses: actions/upload-artifact@v3
with:
name: validation-artifacts
path: validation_results.txt