Skip to content

AdGuard Home config #55

AdGuard Home config

AdGuard Home config #55

Workflow file for this run

name: Check Confs
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
check-allowed-file-names:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check Allowed File Names
run: |
NOT_CONFS=$(find . -not -path '*/\.*' -type f ! \( -name '*.conf' -o -name 'README.md' -o -name 'LICENSE' \))
NOT_CONFS_COUNT=$(echo "${NOT_CONFS}" | wc -w)
if (( NOT_CONFS_COUNT > 0 )); then
echo "The following files have extensions that are not allowed:"
echo "${NOT_CONFS}"
exit 1
fi
- name: Check Executable Bit
run: |
EXECUTABLE_BIT=$(find . -not -path '*/\.*' -type f -executable)
EXECUTABLE_BIT_COUNT=$(echo "${EXECUTABLE_BIT}" | wc -w)
if (( EXECUTABLE_BIT_COUNT > 0 )); then
echo "The following files have executable permissions (not allowed):"
echo "${EXECUTABLE_BIT}"
exit 1
fi
- name: Check Line Endings
run: |
CRLF_ENDINGS=$(find . -not -path '*/\.*' -type f -exec file "{}" ";" | grep CRLF || true)
CRLF_ENDINGS_COUNT=$(echo "${CRLF_ENDINGS}" | wc -w)
if (( CRLF_ENDINGS_COUNT > 0 )); then
echo "The following files have CRLF line endings (not allowed):"
echo "${CRLF_ENDINGS}"
exit 1
fi
- name: Check Version Date Line Exists
run: |
# Date regex based on https://www.html5pattern.com/Dates
VERSION_LINE_MISSING=$(find . -not -path '*/\.*' -type f -name '*.conf' -exec grep -H -c -P '^## Version (?:19|20|21)[0-9]{2}/(?:(?:0[1-9]|1[0-2])/(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])/(?:30))|(?:(?:0[13578]|1[02])/31))$' {} \; | grep 0$ | cut -d':' -f1)
VERSION_LINE_MISSING_COUNT=$(echo "${VERSION_LINE_MISSING}" | wc -w)
if (( VERSION_LINE_MISSING_COUNT > 0 )); then
echo "The following files are missing the version date line or it is not formatted correctly (YYYY/MM/DD):"
echo "${VERSION_LINE_MISSING}"
exit 1
fi