From f578172faea57abdc24fa2c852a0eb457f60b905 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Tue, 29 Oct 2024 17:03:49 -0600 Subject: [PATCH] auto create pr at end of benchmarks and release --- .github/workflows/benchmark.yml | 33 +++++++++++++++++++++++++- .github/workflows/release_parallel.yml | 20 +++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index c2f622b84b..a01f057865 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -35,17 +35,30 @@ jobs: exclude-release-only: ${{ github.event.inputs.exclude-release-benchmarks == true }} create-branch-prefix: - name: Create Branch Prefix + name: Create Branch and Branch Prefix runs-on: ubuntu-latest outputs: branch-prefix: ${{ steps.create-prefix.outputs.branch-prefix }} + base-branch: ${{ steps.create-prefix.outputs.base-branch }} steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} - id: create-prefix run: | VERSION=$(jq -r '.version' package.json) echo "branch-prefix=benchmark--$VERSION-" >> $GITHUB_OUTPUT + echo "base-branch=benchmark--$VERSION" >> $GITHUB_OUTPUT + + - uses: ./.github/actions/configure_git + with: + gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} + + - name: Create base branch + run: | + git checkout -b ${{ steps.create-prefix.outputs.base-branch }} + git push origin ${{ steps.create-prefix.outputs.base-branch }} run-benchmarks: name: ${{ matrix.benchmark_group.name }} @@ -101,3 +114,21 @@ jobs: GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }} + + create-pr: + needs: [finalize-benchmark, create-branch-prefix] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Create Pull Request + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --base ${{ github.ref_name }} \ + --head ${{ needs.create-branch-prefix.outputs.base-branch }} \ + --title "Benchmark Results for ${{ needs.create-branch-prefix.outputs.base-branch }}" \ + --body "Automated PR for benchmark results" diff --git a/.github/workflows/release_parallel.yml b/.github/workflows/release_parallel.yml index 7b0706aab1..972054bb72 100644 --- a/.github/workflows/release_parallel.yml +++ b/.github/workflows/release_parallel.yml @@ -107,7 +107,7 @@ jobs: - uses: ./.github/actions/commit_and_push with: - branch-name: ${{ steps.create-branch-name.outputs.branch-name }} + branch-name: release--${{ needs.prepare-release.outputs.release-version }} commit-message: 'Update dependencies for ${{ matrix.test.displayPath }}' gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }} @@ -145,3 +145,21 @@ jobs: else gh release create "$VERSION" -t "$VERSION" fi + + create-pr: + needs: [prepare-release, finalize-release] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Create Pull Request + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --base ${{ github.ref_name }} \ + --head release--${{ needs.prepare-release.outputs.release-version }} \ + --title "Release ${{ needs.prepare-release.outputs.release-version }}" \ + --body "Automated PR for release ${{ needs.prepare-release.outputs.release-version }}"