Skip to content

Commit 802053c

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. In addition the order of steps was reordered so the clone and checkout of the base repo and base branch was done first then the PR's were fetched and checked out next. This to ensure that our repo is the base of everything rather than the PR's repo which could be an external contributor.
1 parent c4f6b9e commit 802053c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@ 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+
else
29+
git remote add fork-pr https://github.com/${{ github.event.pull_request.head.repo.full_name }}
30+
git fetch fork-pr ${{ github.event.pull_request.head.ref }}
31+
fi
32+
git checkout FETCH_HEAD
2633
2734
- name: Checkout kernel-src-tree-tools
2835
uses: actions/checkout@v4

0 commit comments

Comments
 (0)