From 0b5e6cc2ac47e3f3b7cc149cd788e4750ca67858 Mon Sep 17 00:00:00 2001 From: Ludovico Magnocavallo Date: Tue, 14 Apr 2026 16:22:20 +0200 Subject: [PATCH] fix automated PR review workflow for forks (#3867) --- .github/workflows/pr-review.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml index 3f4a66ebe..378fae5c2 100644 --- a/.github/workflows/pr-review.yml +++ b/.github/workflows/pr-review.yml @@ -15,7 +15,7 @@ name: "Automated PR Review" # yamllint disable-line rule:truthy on: - pull_request: + pull_request_target: types: - opened - synchronize @@ -60,12 +60,12 @@ jobs: - id: generate-diff name: Generate PR Diff env: - BASE_REF: ${{ github.event.pull_request.base.ref }} BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} + PR_NUMBER: ${{ github.event.pull_request.number }} run: | - # Fetch the target branch to ensure we have the base commit to compare against - git fetch origin "$BASE_REF":"$BASE_REF" + # Fetch the pull request head + git fetch origin pull/$PR_NUMBER/head # Generate the diff between the PR base and the PR head git diff "$BASE_SHA"..."$HEAD_SHA" > pr.diff