From a7546fb3e86b37b4fbde111bcf4e3a2ffdf05f01 Mon Sep 17 00:00:00 2001 From: Brett Mastbergen Date: Tue, 12 Aug 2025 16:42:02 -0400 Subject: [PATCH 1/2] github actions: Fix upstream commit check for forks The upstream commit check workflow was failing for pull requests originating from forked repositories. The previous implementation incorrectly assumed the pull request branch existed on the base repository. This commit corrects the workflow to ensure the pull request branch is checked out from the correct source repository, while the base branch is fetched from the target repository. --- .github/workflows/upstream-commit-check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upstream-commit-check.yml b/.github/workflows/upstream-commit-check.yml index ae25072b9522..e95c4e904f8e 100644 --- a/.github/workflows/upstream-commit-check.yml +++ b/.github/workflows/upstream-commit-check.yml @@ -16,12 +16,14 @@ jobs: - name: Checkout PR branch uses: actions/checkout@v4 with: + repository: ${{ github.event.pull_request.head.repo.full_name }} fetch-depth: 0 ref: ${{ github.head_ref }} - name: Checkout base branch run: | - git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} + git remote add base_repo https://github.com/${{ github.repository }}.git + git fetch base_repo ${{ github.base_ref }}:${{ github.base_ref }} - name: Download check_kernel_commits.py run: | From c750f51815542cc15ccd98c226e8c160e7ebecc2 Mon Sep 17 00:00:00 2001 From: Brett Mastbergen Date: Tue, 2 Sep 2025 14:49:31 -0400 Subject: [PATCH 2/2] github actions: Fix process-pull-request for forks The process-pull-request workflow was failing for pull requests originating from forked repositories. The previous implementation incorrectly assumed the pull request branch existed on the base repository. This commit corrects the workflow to ensure the pull request branch is checked out from the correct source repository, while the base branch is fetched from the target repository. --- .github/workflows/process-git-request.rb | 2 +- .github/workflows/process-pull-request.yml | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/process-git-request.rb b/.github/workflows/process-git-request.rb index 04a2ccd49b8b..9be1869d5108 100644 --- a/.github/workflows/process-git-request.rb +++ b/.github/workflows/process-git-request.rb @@ -22,7 +22,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir) # puts "Working Dir : " + working_dir Dir.chdir working_dir # puts "pwd : " + Dir.pwd - git_cmd = "git log --oneline --no-abbrev-commit origin/" + target_branch + ".." + "origin/" + source_branch + git_cmd = "git log --oneline --no-abbrev-commit base_repo/" + target_branch + ".." + "origin/" + source_branch # puts git_cmd out, err, status = Open3.capture3(git_cmd) if status.exitstatus != 0 diff --git a/.github/workflows/process-pull-request.yml b/.github/workflows/process-pull-request.yml index a4f9f43fa425..4187005d147a 100644 --- a/.github/workflows/process-pull-request.yml +++ b/.github/workflows/process-pull-request.yml @@ -9,7 +9,7 @@ on: pull_request: branches: - '**' - - '!mainline' + - '!mainline' permissions: contents: read @@ -24,7 +24,18 @@ jobs: ruby-version: ['3.0'] steps: - - uses: actions/checkout@v4 + - name: Checkout PR branch + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: 0 + ref: ${{ github.head_ref }} + + - name: Checkout base branch + run: | + git remote add base_repo https://github.com/${{ github.repository }}.git + git fetch base_repo ${{ github.base_ref }}:${{ github.base_ref }} + - name: Set up Ruby # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, # change this to (see https://github.com/ruby/setup-ruby#versioning): @@ -39,8 +50,6 @@ jobs: run: | /usr/bin/pip3 install gitPython python -c "import sys; import git; print(sys.version)" - git fetch origin ${{ github.base_ref }} - git fetch origin ${{ github.head_ref }} git remote add linux https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --shallow-since="3 years ago" linux echo "Will run process-git-request.rb with:"