mirror of
https://github.com/linuxserver/reverse-proxy-confs.git
synced 2025-07-06 13:01:35 -07:00
commit
1da0c0c93e
1 changed files with 44 additions and 40 deletions
84
.github/workflows/check_samples.yml
vendored
84
.github/workflows/check_samples.yml
vendored
|
@ -2,54 +2,58 @@ name: Check Samples
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-allowed-file-names:
|
check-allowed-file-names:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Check Allowed File Names
|
- name: Check Allowed File Names
|
||||||
run: |
|
run: |
|
||||||
NOT_SAMPLES=$(find . -not -path '*/\.*' -type f ! \( -name '*.conf.sample' -o -name 'README.md' -o -name 'LICENSE' \))
|
NOT_SAMPLES=$(find . -not -path '*/\.*' -type f ! \( -name '*.conf.sample' -o -name 'README.md' -o -name 'LICENSE' \))
|
||||||
NOT_SAMPLES_COUNT=$(echo "${NOT_SAMPLES}" | wc -w)
|
NOT_SAMPLES_COUNT=$(echo "${NOT_SAMPLES}" | wc -w)
|
||||||
if (( NOT_SAMPLES_COUNT > 0 )); then
|
if (( NOT_SAMPLES_COUNT > 0 )); then
|
||||||
echo "The following files have extensions that are not allowed:"
|
for i in ${NOT_SAMPLES}; do
|
||||||
echo "${NOT_SAMPLES}"
|
echo "::error file=${i},line=1,title=Disallowed filenames::This file extension is not allowed, only .sample is allowed"
|
||||||
exit 1
|
done
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Check Executable Bit
|
- name: Check Executable Bit
|
||||||
run: |
|
run: |
|
||||||
EXECUTABLE_BIT=$(find . -not -path '*/\.*' -type f -executable)
|
EXECUTABLE_BIT=$(find . -not -path '*/\.*' -type f -executable)
|
||||||
EXECUTABLE_BIT_COUNT=$(echo "${EXECUTABLE_BIT}" | wc -w)
|
EXECUTABLE_BIT_COUNT=$(echo "${EXECUTABLE_BIT}" | wc -w)
|
||||||
if (( EXECUTABLE_BIT_COUNT > 0 )); then
|
if (( EXECUTABLE_BIT_COUNT > 0 )); then
|
||||||
echo "The following files have executable permissions (not allowed):"
|
for i in ${EXECUTABLE_BIT}; do
|
||||||
echo "${EXECUTABLE_BIT}"
|
echo "::error file=${i},line=1,title=Executable Bit::This file is set as exectutable, which is not allowed"
|
||||||
exit 1
|
done
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Check Line Endings
|
- name: Check Line Endings
|
||||||
run: |
|
run: |
|
||||||
CRLF_ENDINGS=$(find . -not -path '*/\.*' -type f -exec file "{}" ";" | grep CRLF || true)
|
CRLF_ENDINGS=$(find . -not -path '*/\.*' -type f -exec file "{}" ";" | grep CRLF || true)
|
||||||
CRLF_ENDINGS_COUNT=$(echo "${CRLF_ENDINGS}" | wc -w)
|
CRLF_ENDINGS_COUNT=$(echo "${CRLF_ENDINGS}" | wc -w)
|
||||||
if (( CRLF_ENDINGS_COUNT > 0 )); then
|
if (( CRLF_ENDINGS_COUNT > 0 )); then
|
||||||
echo "The following files have CRLF line endings (not allowed):"
|
for i in ${CRLF_ENDINGS}; do
|
||||||
echo "${CRLF_ENDINGS}"
|
echo "::error file=${i},line=1,title=Line Endings::This file has CRLF (Windows) line endings, which is not allowed"
|
||||||
exit 1
|
done
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Check Version Date Line Exists
|
- name: Check Version Date Line Exists
|
||||||
run: |
|
run: |
|
||||||
# Date regex based on https://www.html5pattern.com/Dates
|
# Date regex based on https://www.html5pattern.com/Dates
|
||||||
VERSION_LINE_MISSING=$(find . -not -path '*/\.*' -type f -name '*.conf.sample' -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=$(find . -not -path '*/\.*' -type f -name '*.conf.sample' -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)
|
VERSION_LINE_MISSING_COUNT=$(echo "${VERSION_LINE_MISSING}" | wc -w)
|
||||||
if (( VERSION_LINE_MISSING_COUNT > 0 )); then
|
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):"
|
for i in ${VERSION_LINE_MISSING}; do
|
||||||
echo "${VERSION_LINE_MISSING}"
|
echo "::error file=${i},line=1,title=Version Line::This file is missing the version date line or it is not formatted correctly (YYYY/MM/DD)"
|
||||||
exit 1
|
done
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue