This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 14ed5e8ae3 forgejo/workflows: rebase PR commits onto target branch
before running verification
14ed5e8ae3 is described below
commit 14ed5e8ae31d0c833afbb5ed0e0ca2c7cfc0db87
Author: Kacper Michajłow <[email protected]>
AuthorDate: Tue Jun 30 13:09:41 2026 +0200
Commit: Kacper Michajłow <[email protected]>
CommitDate: Thu Jul 2 20:20:50 2026 +0000
forgejo/workflows: rebase PR commits onto target branch before running
verification
This simulates the state of the repository after the PR is
rebased-and-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 rebase conflicts are detected. Since
PRs with conflicts cannot be merged, there is no value in running the
remaining verification steps.
This is bit strict as it likely will fail to rebase merge commits,
should they be present in the PR. However, we generally prefer linear
history. It's rebased mostly to avoid search for merge commit in target
branch. While for PR we can ask API how many commit there are and the
parent of that should be merge-base commit, for target branch it's
unknown how deep this common commit is. It would be trivial if we did
full non-shallow clone, but we do shallow and probably want to keep it
this way. This forces us to just replay commits from PR on the tip of
the current target branch. It's fine, this is what we want in the end of
the day.
Incidentally this also fixes recently merged
dd6ae3e02412021e016983cc52c242c35e2d7ab1, which tries to validate commit
messages, but by default clone depth is 1 so only single commit message
of head commit in PR was merged. After this change all commits will be
visible. However, I still liked the API script that we had before, not
sure why this was completely reworked.
Signed-off-by: Kacper Michajłow <[email protected]>
---
.forgejo/actions/rebase-pr/action.yml | 23 +++++++++++++++++++++++
.forgejo/workflows/lint.yml | 2 ++
.forgejo/workflows/test.yml | 6 ++++++
3 files changed, 31 insertions(+)
diff --git a/.forgejo/actions/rebase-pr/action.yml
b/.forgejo/actions/rebase-pr/action.yml
new file mode 100644
index 0000000000..fa8c9e2a09
--- /dev/null
+++ b/.forgejo/actions/rebase-pr/action.yml
@@ -0,0 +1,23 @@
+name: Rebase PR onto target
+
+inputs:
+ path:
+ description: Directory to run in
+ required: false
+ default: .
+
+runs:
+ using: composite
+ steps:
+ - name: Rebase onto target branch
+ if: ${{ forge.event_name == 'pull_request' }}
+ working-directory: ${{ inputs.path }}
+ run: |
+ # Fetch all PR commits + merge-base
+ commits=$(curl -s -o /dev/null -w '%header{X-Total-Count}' '${{
forge.api_url }}/repos/${{ forge.repository }}/pulls/${{
forge.event.pull_request.number
}}/commits?limit=1&verification=false&files=false')
+ git fetch --deepen=$commits origin pull/${{
forge.event.pull_request.number }}/head
+ # Fetch target branch
+ git fetch --depth=1 origin ${{ forge.base_ref }}
+ # Rebase PR commits onto the current state of target branch
+ git rebase --onto origin/${{ forge.base_ref }} ${{
forge.event.pull_request.merge_base }} \
+ || { echo "::error::does not rebase cleanly onto ${{ forge.base_ref
}}"; exit 1; }
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
index 32237eecc7..3e3b0a44b0 100644
--- a/.forgejo/workflows/lint.yml
+++ b/.forgejo/workflows/lint.yml
@@ -16,6 +16,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
+ - name: Rebase onto target branch
+ uses: ./.forgejo/actions/rebase-pr
- name: Install pre-commit CI
id: install
run: |
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
index 3af1522b88..c8ce77b8b5 100644
--- a/.forgejo/workflows/test.yml
+++ b/.forgejo/workflows/test.yml
@@ -29,6 +29,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
+ - name: Rebase onto target branch
+ uses: ./.forgejo/actions/rebase-pr
- name: Configure
run: |
./configure --enable-gpl --enable-nonfree --enable-memory-poisoning
--assert-level=2 \
@@ -86,6 +88,10 @@ jobs:
uses: actions/checkout@v6
with:
path: ffmpeg
+ - name: Rebase onto target branch
+ uses: ./ffmpeg/.forgejo/actions/rebase-pr
+ with:
+ path: ffmpeg
- name: Configure
run: |
mkdir build && cd build
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]