Skip to content

Commit f83ab1f

Browse files
authored
Merge pull request #13442 from Azure/v-atulyadav/asimworkflownew
Asim workflow
2 parents bff5411 + 85bba16 commit f83ab1f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/runAsimSchemaAndDataTesters.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ jobs:
4343
outputs:
4444
approved: ${{ steps.check-approval.outputs.approved }}
4545
steps:
46+
- name: Checkout pull request branch
47+
if: github.event.pull_request != null
48+
uses: actions/checkout@v3
49+
with:
50+
ref: ${{ github.event.pull_request.head.sha }}
51+
repository: ${{ github.event.pull_request.head.repo.full_name }}
52+
fetch-depth: 0
53+
4654
- name: Check if PR needs approval
4755
id: check-approval
4856
run: |
@@ -96,6 +104,28 @@ jobs:
96104
echo "needs_approval=false" >> $GITHUB_OUTPUT
97105
echo "comment_needed=false" >> $GITHUB_OUTPUT
98106
fi
107+
108+
- name: Prevent fork modifications to test infrastructure
109+
if: github.event.pull_request.head.repo.fork == true
110+
run: |
111+
log_info() { echo "ℹ️ $1"; }
112+
log_error() { echo "❌ $1"; }
113+
log_success() { echo "✅ $1"; }
114+
115+
log_info "Checking for modifications to asimParsersTest folder in fork PR..."
116+
117+
# Get the list of modified files
118+
modified_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }})
119+
120+
# Check if any files in .script/tests/asimParsersTest/ have been modified
121+
if echo "$modified_files" | grep -E "\.script/tests/asimParsersTest/" > /dev/null; then
122+
log_error "Fork PRs cannot modify the asimParsersTest test infrastructure folder"
123+
log_error "Modified test files detected:"
124+
echo "$modified_files" | grep "\.script/tests/asimParsersTest/" | sed 's/^/ - /'
125+
exit 1
126+
fi
127+
128+
log_success "No modifications to asimParsersTest folder detected"
99129
100130
- name: Comment on fork PR for approval guidance
101131
if: |

0 commit comments

Comments
 (0)