File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1- name : pull_request_target
1+ name : Valid on: pull_request_target
22
33on :
44 pull_request_target :
1919 id : prepare_json_files
2020 run : |
2121 echo "Collecting changed JSON files..."
22- BASE="origin/ ${{ github.event.pull_request.base.ref }}"
22+ BASE="${{ github.event.pull_request.base.sha }}"
2323 HEAD="${{ github.event.pull_request.head.sha }}"
24+
2425 mapfile -t files < <(git diff --name-only "$BASE" "$HEAD" | grep '\.json$')
26+ echo "Changed JSON files: ${files[@]}"
27+
28+ if [ ${#files[@]} -eq 0 ]; then
29+ echo "No JSON files changed in this PR."
30+ echo "JSON_PAYLOAD_PATH=empty" >> $GITHUB_ENV
31+ exit 0
32+ fi
33+
2534 json_array="["
2635 for file in "${files[@]}"; do
2736 if [ -f "$file" ]; then
3948 echo "JSON_PAYLOAD_PATH=files_payload.json" >> $GITHUB_ENV
4049
4150 - name : Send JSON files to API and check response
51+ if : env.JSON_PAYLOAD_PATH != 'empty'
4252 env :
4353 API_URL : https://valid1-e2akhdekg6a7a2ch.canadacentral-01.azurewebsites.net/
4454 run : |
You can’t perform that action at this time.
0 commit comments