Skip to content

Commit 13e92c5

Browse files
committed
github actions: Allow fork checkout for commit validation
Since we have external contributors we need process each of the commits for faster reviews, validation that header information is correct and to check the state of our tickets so that is actually tracked correctly internally, on behalf of some external contributors.
1 parent c4f6b9e commit 13e92c5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/validate-kernel-commits.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,23 @@ jobs:
1414
timeout-minutes: 120
1515

1616
steps:
17-
- name: Checkout PR branch
17+
- name: Checkout base branch
1818
uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
21-
ref: ${{ github.head_ref }}
21+
ref: ${{ github.event.pull_request.base.ref }}
2222

23-
- name: Checkout base branch
23+
- name: Add and checkout PR branch
2424
run: |
25-
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
25+
set -e # Exit on error
26+
if [ "${{ github.event.pull_request.head.repo.full_name }}" = "${{ github.event.pull_request.base.repo.full_name }}" ]; then
27+
git fetch origin ${{ github.event.pull_request.head.ref }}
28+
git checkout FETCH_HEAD
29+
else
30+
git remote add fork-pr https://github.com/${{ github.event.pull_request.head.repo.full_name }}
31+
git fetch fork-pr ${{ github.event.pull_request.head.ref }}
32+
git checkout FETCH_HEAD
33+
fi
2634
2735
- name: Checkout kernel-src-tree-tools
2836
uses: actions/checkout@v4

0 commit comments

Comments
 (0)