Skip to content

Commit 1c211fb

Browse files
authored
Update PR validation workflow script handling
Refactor PR validation workflow to copy validation script and improve exit code handling.
1 parent 6f01d7a commit 1c211fb

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

.github/workflows/pr-validate.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ jobs:
2626

2727
- name: Checkout PR branch
2828
if: github.event_name == 'workflow_dispatch'
29-
run: gh pr checkout ${{ inputs.pr_number }}
29+
run: |
30+
cp .github/scripts/validate_pr.py /tmp/validate_pr.py
31+
gh pr checkout ${{ inputs.pr_number }}
32+
mkdir -p .github/scripts
33+
cp /tmp/validate_pr.py .github/scripts/validate_pr.py
3034
env:
3135
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3236

@@ -52,12 +56,9 @@ jobs:
5256
id: validate
5357
working-directory: ${{ github.workspace }}
5458
run: |
55-
python .github/scripts/validate_pr.py changed_files.txt 2>&1 | tee result.txt
56-
echo "exit_code=${PIPESTATUS[0]}" >> $GITHUB_OUTPUT
57-
58-
- name: Print result
59-
if: always()
60-
run: cat result.txt
59+
python .github/scripts/validate_pr.py changed_files.txt > result.txt 2>&1
60+
echo "exit_code=$?" >> $GITHUB_OUTPUT
61+
cat result.txt
6162
6263
- name: Comment on PR
6364
if: always() && (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')

0 commit comments

Comments
 (0)