From f54f3ccb0b97b4fea9735f912c3d1e6ffd397d10 Mon Sep 17 00:00:00 2001 From: Juro Oravec Date: Wed, 19 Mar 2025 12:54:50 +0100 Subject: [PATCH] ci: Make a separate PR when pushing release benchmark data (#1045) --- .github/workflows/docs.yml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b544edb3..390d2946 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -46,11 +46,6 @@ jobs: - name: Configure git run: | - # Get the master branch so we can run benchmarks on it - git remote add upstream https://github.com/${{ github.repository }}.git - git fetch origin master:master - git checkout master - # required for "mike deploy" command below which pushes to gh-pages git config user.name github-actions git config user.email github-actions@github.com @@ -62,6 +57,11 @@ jobs: - name: Run benchmarks for tag if: github.ref_type == 'tag' && github.event_name == 'push' run: | + # Get the master branch so we can run benchmarks on it + git remote add upstream https://github.com/${{ github.repository }}.git + git fetch origin master:master + git checkout master + # Get tag name TAG=${GITHUB_REF#refs/tags/} echo "TAG: $TAG" @@ -117,14 +117,30 @@ jobs: echo "Benchmarks site DONE." # Stage and commit benchmark results + # 1. Create a new branch and commit benchmark results echo "Staging and committing benchmark results..." + git checkout -b "benchmark-${TAG}" git add .asv/results/ git add docs/benchmarks/ git commit -m "Add benchmark results for ${TAG}" echo "Benchmark results committed." - git push origin master + + # 2. Push to the new branch + echo "Pushing benchmark results to new branch..." + git push -u origin "benchmark-${TAG}" + + # 3. Create a PR + PR_URL="$(gh pr create --title "chore: Add benchmark results for ${TAG}" --body "Add benchmark results for ${TAG}" --base master)" + echo "PR URL: ${PR_URL}" + + # 4. Merge the PR + gh pr merge "${PR_URL}" --admin --squash --delete-branch echo "Benchmark results pushed to master." + # 5. Go back to the original branch + git checkout master + git pull + ############################## # BUILD & DEPLOY DOCS ##############################