@@ -2,14 +2,7 @@ name: Validate Environment Configs
22
33on :
44 pull_request :
5- paths :
6- - ' environments/library/**/*.yaml'
7- - ' environments/library/**/*.yml'
8- - ' environments/templates/**/*.yaml'
9- - ' environments/templates/**/*.yml'
10- - ' scripts/validate_environment_config.py'
11- - ' scripts/models/environment_config.py'
12- - ' .github/workflows/validate-configs.yml'
5+ # Remove path filters to ensure workflow always runs
136
147permissions :
158 contents : read
@@ -26,33 +19,38 @@ jobs:
2619 with :
2720 fetch-depth : 0 # Get full history for diff
2821
29- - name : Set up Python 3.12
30- uses : actions/setup-python@v5
31- with :
32- python-version : ' 3.12'
33-
34- - name : Install dependencies
22+ - name : Check for relevant changes
23+ id : check-changes
3524 run : |
36- python -m pip install --upgrade pip
37- pip install pyyaml pydantic
25+ # Check if any environment config files were changed
26+ git diff --name-only origin/${{ github.base_ref }}..HEAD > all-changes.txt
3827
39- - name : Get changed config files
40- id : changed-files
41- run : |
42- # Get list of changed YAML files in environments/
43- git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E 'environments/.+\.(yaml|yml)$' > changed-configs.txt || true
28+ # Filter for environment config files
29+ grep -E 'environments/.+\.(yaml|yml)$|scripts/validate_environment_config.py|scripts/models/environment_config.py' all-changes.txt > changed-configs.txt || true
4430
4531 if [ -s changed-configs.txt ]; then
4632 echo "has_changes=true" >> $GITHUB_OUTPUT
47- echo "Changed configuration files:"
33+ echo "Environment configuration files were changed :"
4834 cat changed-configs.txt
4935 else
5036 echo "has_changes=false" >> $GITHUB_OUTPUT
51- echo "No configuration files changed"
37+ echo "No environment configuration files were changed - skipping validation "
5238 fi
5339
40+ - name : Set up Python 3.12
41+ if : steps.check-changes.outputs.has_changes == 'true'
42+ uses : actions/setup-python@v5
43+ with :
44+ python-version : ' 3.12'
45+
46+ - name : Install dependencies
47+ if : steps.check-changes.outputs.has_changes == 'true'
48+ run : |
49+ python -m pip install --upgrade pip
50+ pip install pyyaml pydantic
51+
5452 - name : Validate changed configurations
55- if : steps.changed-files .outputs.has_changes == 'true'
53+ if : steps.check-changes .outputs.has_changes == 'true'
5654 run : |
5755 echo "Validating changed configuration files..."
5856 exit_code=0
8381 echo "✅ All configuration files validated successfully"
8482 fi
8583
84+ - name : Skip validation message
85+ if : steps.check-changes.outputs.has_changes == 'false'
86+ run : |
87+ echo "✅ No environment configuration changes to validate"
88+
8689 - name : Comment PR with validation success
87- if : success() && steps.changed-files .outputs.has_changes == 'true'
90+ if : success() && steps.check-changes .outputs.has_changes == 'true'
8891 uses : actions/github-script@v7
8992 with :
9093 script : |
@@ -100,7 +103,7 @@ jobs:
100103 });
101104
102105 - name : Comment PR with validation failure
103- if : failure() && steps.changed-files .outputs.has_changes == 'true'
106+ if : failure() && steps.check-changes .outputs.has_changes == 'true'
104107 uses : actions/github-script@v7
105108 with :
106109 script : |
0 commit comments