Skip to content

Commit 82d6e1b

Browse files
committed
Refactor pull request validation workflow to separate base branch checkout and script copying
1 parent c94f19c commit 82d6e1b

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/validate-pull-request.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,29 @@ jobs:
3838
name: 'run validation'
3939
})
4040
41-
- name: Checkout code
41+
- name: Checkout base branch to get latest validation script
42+
uses: actions/checkout@v4
43+
with:
44+
ref: ${{ github.base_ref }}
45+
fetch-depth: 0
46+
path: base-repo
47+
48+
- name: Checkout PR code
4249
uses: actions/checkout@v4
4350
with:
4451
ref: ${{ github.event.pull_request.head.sha }}
4552
fetch-depth: 0
53+
path: pr-repo
54+
55+
- name: Copy validation script from base branch
56+
run: |
57+
mkdir -p pr-repo/.github/scripts/
58+
cp base-repo/.github/scripts/validate-pull-request.js pr-repo/.github/scripts/
59+
cd pr-repo
4660
4761
- name: Get changed files
4862
id: changed-files
63+
working-directory: pr-repo
4964
uses: tj-actions/changed-files@v41
5065
with:
5166
files: '**/*'
@@ -58,6 +73,7 @@ jobs:
5873
node-version: '18'
5974

6075
- name: Validate pull request and post comment
76+
working-directory: pr-repo
6177
env:
6278
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6379
GITHUB_REPOSITORY: ${{ github.repository }}

0 commit comments

Comments
 (0)