Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 12 additions & 51 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,53 +71,11 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Validate Secrets Configuration
env:
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
run: |
echo "Validating secrets configuration..."

# Check if running in main repository (not a fork) for pull_request or workflow_dispatch
if [ "${{ github.repository }}" = "frigini/MeAjudaAi" ] && \
([ "${{ github.event_name }}" = "pull_request" ] || \
[ "${{ github.event_name }}" = "workflow_dispatch" ]); then
echo "Running in main repository context - strict validation enabled"

# Validate all required database secrets
HAS_ERROR=0

if [ -z "$POSTGRES_PASSWORD" ]; then
echo "ERROR: POSTGRES_PASSWORD secret not configured in main repository"
echo "This secret is required for pull request validation"
HAS_ERROR=1
else
echo "SUCCESS: POSTGRES_PASSWORD secret configured"
fi

if [ -z "$POSTGRES_USER" ]; then
echo "ERROR: POSTGRES_USER secret not configured in main repository"
echo "This secret is required for pull request validation"
HAS_ERROR=1
else
echo "SUCCESS: POSTGRES_USER secret configured"
fi

if [ -z "$POSTGRES_DB" ]; then
echo "ERROR: POSTGRES_DB secret not configured in main repository"
echo "This secret is required for pull request validation"
HAS_ERROR=1
else
echo "SUCCESS: POSTGRES_DB secret configured"
fi

if [ $HAS_ERROR -eq 1 ]; then
echo "Secret validation failed - exiting"
exit 1
fi
else
echo "Running in fork or non-PR/dispatch event - lenient mode (using test defaults)"
fi
echo "Using PostgreSQL credentials with fallback defaults"
echo "POSTGRES_USER: ${{ env.POSTGRES_USER }}"
echo "POSTGRES_DB: ${{ env.POSTGRES_DB }}"
echo "POSTGRES_PASSWORD: [REDACTED]"

echo "Database configuration validated"

Expand Down Expand Up @@ -317,11 +275,14 @@ jobs:
INCLUDE_FILTER="[MeAjudaAi.*]*"
fi

# NOTE: EXCLUDE_FILTER is currently hardcoded for all modules.
# Future enhancement: Consider adding per-module exclusion patterns
# as part of the MODULES array definition (e.g., "Module:path/:Include:Exclude")
# to support module-specific test category or infrastructure exclusions.
EXCLUDE_FILTER="[*.Tests*]*,[*Test*]*,[testhost]*"
# NOTE: EXCLUDE_FILTER includes compiler-generated code exclusions
# to provide accurate coverage metrics for hand-written code only.
# Excluded patterns:
# - Test assemblies: [*.Tests*]*, [*Test*]*, [testhost]*
# - OpenApi generated: [*Microsoft.AspNetCore.OpenApi.Generated*]*
# - Compiler services: [*System.Runtime.CompilerServices*]*
# - Regex generator: [*System.Text.RegularExpressions.Generated*]*
EXCLUDE_FILTER="[*.Tests*]*,[*Test*]*,[testhost]*,[*Microsoft.AspNetCore.OpenApi.Generated*]*,[*System.Runtime.CompilerServices*]*,[*System.Text.RegularExpressions.Generated*]*"

echo " Include: $INCLUDE_FILTER"
echo " Exclude: $EXCLUDE_FILTER"
Expand Down