-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (51 loc) · 1.61 KB
/
Copy pathpr-test.yml
File metadata and controls
61 lines (51 loc) · 1.61 KB
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
name: Test Pull Request
on:
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Validate event files (schema)
run: npm run validate
- name: Ensure no duplicate event files
run: |
FILES=$(ls data/events/*.json | sed 's#.*/##')
DUPLICATES=$(echo "$FILES" | sort | uniq -d)
if [ -n "$DUPLICATES" ]; then
for f in $DUPLICATES; do
echo "::error file=data/events/$f::Duplicate event file name"
done
exit 1
fi
echo "No duplicate filenames found."
- name: Ensure no duplicate event names
run: |
NAMES=$(jq -r '.name' data/events/*.json)
DUPLICATES=$(echo "$NAMES" | sort | uniq -d)
if [ -n "$DUPLICATES" ]; then
for name in $DUPLICATES; do
file=$(grep -Rl "\"name\": \"$name\"" data/events)
echo "::error file=$file::Duplicate event name \"$name\""
done
exit 1
fi
echo "No duplicate event names found."
- name: Ensure JSON is valid
run: |
for f in data/events/*.json; do
if ! jq empty "$f" >/dev/null 2>&1; then
echo "::error file=$f::Invalid JSON format"
exit 1
fi
done
echo "All JSON files are well-formatted."