-
Notifications
You must be signed in to change notification settings - Fork 12
52 lines (47 loc) · 1.33 KB
/
quality-gate.yml
File metadata and controls
52 lines (47 loc) · 1.33 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
name: quality-gate
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
jobs:
changed-files:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
outputs:
source_changed: ${{ steps.filter.outputs.source }}
tests_changed: ${{ steps.filter.outputs.tests }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
source:
- '**/*.ts'
- '**/*.tsx'
- '**/*.js'
- '**/*.jsx'
- '**/*.mjs'
- '**/*.go'
- '**/*.rs'
- '**/*.py'
- '**/*.sh'
- '!**/*.test.*'
- '!**/*.spec.*'
tests:
- '**/*.test.*'
- '**/*.spec.*'
- '**/test/**'
- '**/tests/**'
enforce-test-delta:
needs: changed-files
if: needs.changed-files.outputs.source_changed == 'true'
runs-on: ubuntu-latest
steps:
- name: Require test updates when source changes
run: |
if [ "${{ needs.changed-files.outputs.tests_changed }}" != "true" ]; then
echo "Source files changed without accompanying test changes."
exit 1
fi