PR #23655 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23655
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23655.patch

Merge the target branch into the PR branch before running verification.
This simulates the state of the repository after the PR is merged into
the target branch and validates the merged result rather than the PR
branch in isolation.

Without this step, CI may run against a stale branch. A PR that merges
cleanly can still fail verification after merging into target because
the target branch may have advanced and changed tests. Conversely, the
Docker image used for the build may no longer work with the old
repository state when testing an old PR branch. This also allows the PR
to be revalidated by simply rerunning CI, without requiring an explicit
rebase.

This change also fails CI early when merge conflicts are detected. Since
PRs with conflicts cannot be merged, there is no value in running the
remaining verification steps.

Although our merge policy is rebase-and-merge, performing a temporary
merge for CI is sufficient to validate the result and does not affect
how the PR is ultimately merged.


From f553b5536a3863be1dc74a7a92833f559cc6f3db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Tue, 30 Jun 2026 13:09:41 +0200
Subject: [PATCH] forgejo/workflows: merge target branch before running
 verification
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Merge the target branch into the PR branch before running verification.
This simulates the state of the repository after the PR is merged into
the target branch and validates the merged result rather than the PR
branch in isolation.

Without this step, CI may run against a stale branch. A PR that merges
cleanly can still fail verification after merging into target because
the target branch may have advanced and changed tests. Conversely, the
Docker image used for the build may no longer work with the old
repository state when testing an old PR branch. This also allows the PR
to be revalidated by simply rerunning CI, without requiring an explicit
rebase.

This change also fails CI early when merge conflicts are detected. Since
PRs with conflicts cannot be merged, there is no value in running the
remaining verification steps.

Although our merge policy is rebase-and-merge, performing a temporary
merge for CI is sufficient to validate the result and does not affect
how the PR is ultimately merged.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 .forgejo/workflows/lint.yml |  5 +++++
 .forgejo/workflows/test.yml | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
index 32237eecc7..6016917c43 100644
--- a/.forgejo/workflows/lint.yml
+++ b/.forgejo/workflows/lint.yml
@@ -16,6 +16,11 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v6
+      - name: Merge target branch
+        if: forge.event_name == 'pull_request'
+        run: |
+          git fetch origin ${{ github.base_ref }}
+          git merge origin/${{ github.base_ref }}
       - name: Install pre-commit CI
         id: install
         run: |
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
index 3af1522b88..e5a957a30e 100644
--- a/.forgejo/workflows/test.yml
+++ b/.forgejo/workflows/test.yml
@@ -29,6 +29,11 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v6
+      - name: Merge target branch
+        if: forge.event_name == 'pull_request'
+        run: |
+          git fetch origin ${{ github.base_ref }}
+          git merge origin/${{ github.base_ref }}
       - name: Configure
         run: |
           ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning 
--assert-level=2 \
@@ -86,6 +91,11 @@ jobs:
         uses: actions/checkout@v6
         with:
           path: ffmpeg
+      - name: Merge target branch
+        if: forge.event_name == 'pull_request'
+        run: |
+          git -C ffmpeg fetch origin ${{ github.base_ref }}
+          git -C ffmpeg merge origin/${{ github.base_ref }}
       - name: Configure
         run: |
           mkdir build && cd build
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to