File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,18 @@ jobs:
27
27
- name : backend
28
28
dir : backend
29
29
triggers : ('backend/')
30
+ expected_triggered : false
30
31
- name : frontend-merge
31
32
dir : frontend
32
33
triggers : ('.')
34
+ expected_triggered : true
33
35
- name : frontend-pr
34
36
dir : frontend
37
+ expected_triggered : true
35
38
steps :
36
39
- uses : actions/checkout@v5
37
- - uses : ./
40
+ - id : action
41
+ uses : ./
38
42
with :
39
43
commands : |
40
44
npm ci
51
55
-Dsonar.tests.inclusions=**/*spec.ts
52
56
sonar_token : ${{ matrix.name == 'backend' && secrets.SONAR_TOKEN_BACKEND || secrets.SONAR_TOKEN_FRONTEND }}
53
57
triggers : ${{ matrix.triggers }}
58
+
59
+ - name : Verify trigger behavior
60
+ run : |
61
+ echo "🔍 Verifying trigger behavior for ${{ matrix.name }}"
62
+ echo "Expected: ${{ matrix.expected_triggered }}"
63
+ echo "Actual: ${{ steps.action.outputs.triggered }}"
64
+
65
+ case "${{ matrix.name }}" in
66
+ "backend")
67
+ if [ "${{ steps.action.outputs.triggered }}" != "false" ]; then
68
+ echo "❌ Backend job should NOT have been triggered (no backend/ changes)"
69
+ exit 1
70
+ else
71
+ echo "✅ Backend job correctly NOT triggered"
72
+ fi
73
+ ;;
74
+ "frontend-merge")
75
+ if [ "${{ steps.action.outputs.triggered }}" != "true" ]; then
76
+ echo "❌ Frontend-merge job should have been triggered (triggers: '.')"
77
+ exit 1
78
+ else
79
+ echo "✅ Frontend-merge job correctly triggered"
80
+ fi
81
+ ;;
82
+ "frontend-pr")
83
+ if [ "${{ steps.action.outputs.triggered }}" != "true" ]; then
84
+ echo "❌ Frontend-pr job should have been triggered (no triggers = always run)"
85
+ exit 1
86
+ else
87
+ echo "✅ Frontend-pr job correctly triggered"
88
+ fi
89
+ ;;
90
+ esac
91
+
92
+ echo "🎉 ${{ matrix.name }} trigger behavior verified correctly!"
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ inputs:
49
49
description : Non-default branch to clone (used for testing this action)
50
50
default : " "
51
51
52
+ outputs :
53
+ triggered :
54
+ description : Whether the action was triggered based on path changes
55
+ value : ${{ steps.diff.outputs.triggered }}
56
+
52
57
runs :
53
58
using : composite
54
59
steps :
You can’t perform that action at this time.
0 commit comments