From b3c8418cf22e677fc04bedc1cbbc02a22662392c Mon Sep 17 00:00:00 2001 From: Diego Alonso Alvarez Date: Fri, 28 Aug 2026 13:12:42 +0100 Subject: [PATCH 1/3] Use PR instead of direct push to main --- .github/workflows/cargo-test.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cargo-test.yml b/.github/workflows/cargo-test.yml index f28420db3..5b96bb55f 100644 --- a/.github/workflows/cargo-test.yml +++ b/.github/workflows/cargo-test.yml @@ -79,14 +79,26 @@ jobs: # Always write a job summary table, not only when a regression is found. summary-always: true - - name: Commit updated baseline + - name: Create pull request with updated baseline # Only update the stored baseline when code is merged to main. On pull # requests the job reads the baseline for comparison but must not overwrite # it, since the PR branch has not yet been reviewed and merged. + # The PR is opened using GITHUB_TOKEN, which means GitHub's built-in + # anti-recursion protection applies: the pull_request event fired by + # creating this PR will not trigger a new workflow run. + # [skip ci] in the commit message and title prevents a redundant workflow + # run when the PR is squash-merged back to main. if: github.ref == 'refs/heads/main' && github.event_name == 'push' - run: | - git config user.name "GitHub Actions" - git config user.email "github-actions@github.com" - git add benches/benchmark-data.json - git diff --staged --quiet || git commit -m "chore: update benchmark baseline [skip ci]" - git push + uses: peter-evans/create-pull-request@v7 + with: + commit-message: "chore: update benchmark baseline [skip ci]" + branch: chore/benchmark-baseline + delete-branch: true + title: "chore: update benchmark baseline [skip ci]" + body: | + Automated update of the benchmark baseline data after a push to `main`. + + > [!NOTE] + > Merge using **Squash merge** to ensure the `[skip ci]` tag is + > preserved in the merge commit, preventing a redundant benchmark run. + add-paths: benches/benchmark-data.json From cd0113bc0769f524b721fc7da42ec71e0994c278 Mon Sep 17 00:00:00 2001 From: Diego Alonso Alvarez Date: Fri, 28 Aug 2026 13:16:15 +0100 Subject: [PATCH 2/3] Expand explanation --- .github/workflows/cargo-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cargo-test.yml b/.github/workflows/cargo-test.yml index 5b96bb55f..a962e4ff2 100644 --- a/.github/workflows/cargo-test.yml +++ b/.github/workflows/cargo-test.yml @@ -86,6 +86,9 @@ jobs: # The PR is opened using GITHUB_TOKEN, which means GitHub's built-in # anti-recursion protection applies: the pull_request event fired by # creating this PR will not trigger a new workflow run. + # The fixed branch name (chore/benchmark-baseline) ensures that if further + # pushes to main occur before this PR is merged, the action force-pushes + # to the same branch and updates the existing PR rather than opening a new one. # [skip ci] in the commit message and title prevents a redundant workflow # run when the PR is squash-merged back to main. if: github.ref == 'refs/heads/main' && github.event_name == 'push' From 6bc4ee774f50ab423e5d39f8aff4181273caf1b8 Mon Sep 17 00:00:00 2001 From: Diego Alonso Alvarez Date: Fri, 28 Aug 2026 14:22:03 +0100 Subject: [PATCH 3/3] Upgrade version action --- .github/workflows/cargo-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cargo-test.yml b/.github/workflows/cargo-test.yml index a962e4ff2..ef32a7c53 100644 --- a/.github/workflows/cargo-test.yml +++ b/.github/workflows/cargo-test.yml @@ -92,7 +92,7 @@ jobs: # [skip ci] in the commit message and title prevents a redundant workflow # run when the PR is squash-merged back to main. if: github.ref == 'refs/heads/main' && github.event_name == 'push' - uses: peter-evans/create-pull-request@v7 + uses: peter-evans/create-pull-request@v8 with: commit-message: "chore: update benchmark baseline [skip ci]" branch: chore/benchmark-baseline @@ -103,5 +103,6 @@ jobs: > [!NOTE] > Merge using **Squash merge** to ensure the `[skip ci]` tag is - > preserved in the merge commit, preventing a redundant benchmark run. + > preserved in the squash-merge commit message, preventing a redundant + > benchmark run. add-paths: benches/benchmark-data.json