-
-
Notifications
You must be signed in to change notification settings - Fork 348
55 lines (48 loc) · 1.56 KB
/
Copy pathregex.yml
File metadata and controls
55 lines (48 loc) · 1.56 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
name: Validate Regex Patterns
on:
push:
paths:
- 'regex_patterns/**/*.yml'
- 'regex_patterns/**/*.yaml'
- '.github/workflows/regex.yml'
- 'scripts/validatePattern.ps1'
pull_request:
paths:
- 'regex_patterns/**/*.yml'
- 'regex_patterns/**/*.yaml'
- '.github/workflows/regex.yml'
- 'scripts/validatePattern.ps1'
workflow_dispatch:
jobs:
discover-patterns:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
patterns=$(find regex_patterns -name "*.yml" -o -name "*.yaml" | jq -R -s -c 'split("\n")[:-1] | map({file: ., name: (. | split("/")[-1] | split(".")[0])})')
echo "matrix=$patterns" >> $GITHUB_OUTPUT
echo "Found patterns: $patterns"
validate-pattern:
needs: discover-patterns
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pattern: ${{ fromJson(needs.discover-patterns.outputs.matrix) }}
name: Validate ${{ matrix.pattern.name }}
steps:
- uses: actions/checkout@v4
- name: Setup PowerShell
run: |
sudo apt-get update
sudo apt-get install -y powershell
- name: Validate Pattern
run: |
pwsh scripts/validatePattern.ps1 -YamlFilePath "${{ matrix.pattern.file }}"
- name: Run Unit Tests
run: |
echo "TODO: Implement unit tests for ${{ matrix.pattern.file }}"
# TODO: Add test runner command here