| 1 |
name: "Check Warnings" |
| 2 |
description: "Filter build warnings against an allowlist" |
| 3 |
|
| 4 |
inputs: |
| 5 |
log-file: |
| 6 |
description: "Path to build log file" |
| 7 |
required: true |
| 8 |
allowlist: |
| 9 |
description: "Path to allowed warnings regex file" |
| 10 |
required: true |
| 11 |
warning-regex: |
| 12 |
description: "Regex to extract warnings from the log" |
| 13 |
required: true |
| 14 |
|
| 15 |
runs: |
| 16 |
using: "composite" |
| 17 |
steps: |
| 18 |
- name: Extract warnings |
| 19 |
shell: bash |
| 20 |
run: | |
| 21 |
echo "Extracting warnings from ${{ inputs.log-file }} using regex: ${{ inputs['warning-regex'] }}" |
| 22 |
grep -E "${{ inputs['warning-regex'] }}" "${{ inputs.log-file }}" | tee warnings.log || true |
| 23 |
|
| 24 |
if [ ! -s warnings.log ]; then |
| 25 |
echo "No warnings found." |
| 26 |
exit 0 |
| 27 |
fi |
| 28 |
|
| 29 |
echo "Filtering against allowlist ${{ inputs.allowlist }}" |
| 30 |
grep -v -F -f "${{ inputs.allowlist }}" warnings.log | tee disallowed.log || true |
| 31 |
|
| 32 |
if [ -s disallowed.log ]; then |
| 33 |
echo "::error::Disallowed warnings detected:" |
| 34 |
cat disallowed.log |
| 35 |
exit 1 |
| 36 |
else |
| 37 |
echo "All warnings are allowed." |
| 38 |
fi |