From 69dbb9caa693d64daa440d1baae7af9c69c2cd05 Mon Sep 17 00:00:00 2001 From: fabriziosalmi Date: Thu, 16 Jan 2025 14:14:32 +0100 Subject: [PATCH] action fix --- .github/workflows/nginx.yml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/nginx.yml b/.github/workflows/nginx.yml index 5086df3..df01c6b 100644 --- a/.github/workflows/nginx.yml +++ b/.github/workflows/nginx.yml @@ -41,21 +41,6 @@ jobs: exit 1 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 run: | if [ ! -f "tests/nginx.conf" ]; then @@ -75,6 +60,10 @@ jobs: echo " include /etc/nginx/$(basename $file);" >> 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 docker run --rm -v $(pwd)/$file:/etc/nginx/$(basename $file):ro \ -v $(pwd)/temp_nginx.conf:/etc/nginx/nginx.conf:ro \ @@ -92,4 +81,4 @@ jobs: -v $(pwd)/merged_waf_rules.conf:/etc/nginx/merged_waf_rules.conf:ro \ -v $(pwd)/tests/nginx.conf:/etc/nginx/tests/nginx.conf:ro \ -v $(pwd)/temp_nginx.conf:/etc/nginx/nginx.conf:ro \ - nginx nginx -t + nginx nginx -t \ No newline at end of file