@@ -27,11 +27,38 @@ jobs:
2727 with :
2828 fetch-depth : 0
2929 token : ${{ secrets.GITHUB_TOKEN }}
30+ - name : Debug Environment Decision
31+ run : |
32+ # Construct the condition result manually for debugging
33+ EVENT_NAME="${{ github.event_name }}"
34+ FILES_CHANGED="${{ toJSON(github.event.pull_request.files.*.filename) }}"
35+ PR_AUTHOR="${{ github.event.pull_request.user.login }}"
36+
37+ echo "Event Name: $EVENT_NAME"
38+ echo "Files Changed: $FILES_CHANGED"
39+ echo "PR Author: $PR_AUTHOR"
40+
41+ # Check workflow file changes
42+ if [[ "$FILES_CHANGED" == *".github/workflows/"* ]]; then
43+ echo "Workflow files changed: YES"
44+ else
45+ echo "Workflow files changed: NO"
46+ fi
47+
48+ # Check author conditions
49+ if [[ "$PR_AUTHOR" != "misrasaurabh1" && "$PR_AUTHOR" != "KRRT7" ]]; then
50+ echo "Author needs approval: YES"
51+ else
52+ echo "Author needs approval: NO"
53+ fi
54+
55+ # Selected environment
56+ echo "Selected Environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}"
3057
3158 - name : Validate PR for workflow changes
3259 run : |
3360 # Check for any workflow changes
34- if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
61+ if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head. sha }}" | grep -q "^.github/workflows/"; then
3562 echo "⚠️ Workflow changes detected."
3663 # Get the PR author
3764 AUTHOR="${{ github.event.pull_request.user.login }}"
0 commit comments