@@ -34,13 +34,35 @@ jobs:
34
34
deactivate
35
35
36
36
- name : Parse false positive detections by desired categories
37
- id : parse_detections
38
37
run : |
39
38
grep -oP '(?<=test_false_pos\[)[^\]]+(?=\].*result was Claimed)' fp_test_results.txt \
40
39
| sort -u > false_positive_exclusions.txt
41
40
grep -oP '(?<=test_false_pos\[)[^\]]+(?=\].*result was WAF)' fp_test_results.txt \
42
41
| sort -u > waf_hits.txt
43
42
43
+ - name : Detect if exclusions list changed
44
+ id : detect_changes
45
+ run : |
46
+ git fetch origin exclusions || true
47
+
48
+ if git show origin/exclusions:exclusions.txt >/dev/null 2>&1; then
49
+ # If the exclusions branch and file exist, compare
50
+ if git diff --quiet origin/exclusions -- exclusions.txt; then
51
+ echo "changed=false" >> "$GITHUB_OUTPUT"
52
+ else
53
+ echo "changed=true" >> "$GITHUB_OUTPUT"
54
+ fi
55
+ else
56
+ # If the exclusions branch or file do not exist, treat as changed
57
+ echo "changed=true" >> "$GITHUB_OUTPUT"
58
+ fi
59
+
60
+ if git diff --quiet false_positive_exclusions.txt; then
61
+ echo "exclusions_changed=false" >> $GITHUB_OUTPUT
62
+ else
63
+ echo "exclusions_changed=true" >> $GITHUB_OUTPUT
64
+ fi
65
+
44
66
- name : Quantify and display results
45
67
run : |
46
68
FP_COUNT=$(wc -l < false_positive_exclusions.txt | xargs)
50
72
echo ">>> WAF hits:" && cat waf_hits.txt
51
73
52
74
- name : Commit and push exclusions list
53
- if : steps.parse_detections .outputs.changed == 'true' || steps.parse_detections.outputs.changed == 'true'
75
+ if : steps.detect_changes .outputs.exclusions_changed == 'true'
54
76
run : |
55
77
git config user.name "Paul Pfeister (automation)"
56
78
git config user.email "[email protected] "
0 commit comments