mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-17 17:55:48 +00:00
action fix
This commit is contained in:
parent
d2a51a1e17
commit
69dbb9caa6
19
.github/workflows/nginx.yml
vendored
19
.github/workflows/nginx.yml
vendored
@ -41,21 +41,6 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Patch .conf files to fix if directives
|
|
||||||
run: |
|
|
||||||
for file in waf_rules/waf_patterns/nginx/*.conf; do
|
|
||||||
echo "Patching $file to ensure 'if' directives are inside a server block..."
|
|
||||||
if grep -q "if " "$file" && ! grep -q "server {" "$file"; then
|
|
||||||
echo "Adding server block to $file..."
|
|
||||||
echo "server {" > temp.conf
|
|
||||||
cat "$file" >> temp.conf
|
|
||||||
echo "}" >> temp.conf
|
|
||||||
mv temp.conf "$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "Patched files:"
|
|
||||||
ls -l waf_rules/waf_patterns/nginx/*.conf
|
|
||||||
|
|
||||||
- name: Verify nginx.conf exists
|
- name: Verify nginx.conf exists
|
||||||
run: |
|
run: |
|
||||||
if [ ! -f "tests/nginx.conf" ]; then
|
if [ ! -f "tests/nginx.conf" ]; then
|
||||||
@ -75,6 +60,10 @@ jobs:
|
|||||||
echo " include /etc/nginx/$(basename $file);" >> temp_nginx.conf
|
echo " include /etc/nginx/$(basename $file);" >> temp_nginx.conf
|
||||||
echo "}" >> temp_nginx.conf
|
echo "}" >> temp_nginx.conf
|
||||||
|
|
||||||
|
# Debug: Print the temporary nginx.conf
|
||||||
|
echo "Temporary nginx.conf for validation:"
|
||||||
|
cat temp_nginx.conf
|
||||||
|
|
||||||
# Validate the file using Docker
|
# Validate the file using Docker
|
||||||
docker run --rm -v $(pwd)/$file:/etc/nginx/$(basename $file):ro \
|
docker run --rm -v $(pwd)/$file:/etc/nginx/$(basename $file):ro \
|
||||||
-v $(pwd)/temp_nginx.conf:/etc/nginx/nginx.conf:ro \
|
-v $(pwd)/temp_nginx.conf:/etc/nginx/nginx.conf:ro \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user