diff --git a/.github/scripts/copy_to_versioned.sh b/.github/scripts/copy_to_versioned.sh new file mode 100755 index 0000000000..3187a2aa0e --- /dev/null +++ b/.github/scripts/copy_to_versioned.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +echo "Open PR to versioned branch (or not, if it was already there)" +echo "" +echo "Skipping failure here too, becuase we don't actually care" +echo "if the PR is already there." +gh pr create -f --head --main --base versioned || true + +echo "This ensures we have our commits pushed. We could be up to date" +echo "already. But it doesn't really matter." +git push || true + +echo "Setting PR to merge automatically..." +gh pr merge versioned --auto diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b4f2bfb8f..c0b35df695 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,16 +15,13 @@ jobs: automerge: name: Auto-merge if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' - needs: Test runs-on: ubuntu-latest permissions: pull-requests: write contents: write steps: - name: 'Merge (if dependabot)' - uses: fastify/github-action-merge-dependabot@v3 - with: - github-token: ${{secrets.GITHUB_TOKEN}} + run: gh pr merge versioned --auto Test: @@ -57,6 +54,31 @@ jobs: # bazel generated node_modules run: bazelisk test //... + TestForMergeToVersioned: + # This runs just the tests that are specified not to run on main + if: github.ref == 'refs/heads/versioned' + name: Tests (for merging into versioned branch) + runs-on: ubuntu-latest + needs: Test + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Restore bazel cache + uses: actions/cache@v3.0.3 + env: + cache-name: bazel-cache + with: + path: | + ~/.cache/bazelisk + ~/.cache/bazel + key: ${{ runner.os }}-${{ env.cache-name }} + - name: All tests + run: bazelisk test //... --test_tag_filters=do_not_run_on_main + deployment: if: github.event_name == 'push' && github.ref == 'refs/heads/versioned' runs-on: ubuntu-latest @@ -97,10 +119,6 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Open PR to 'versioned' branch - run: gh pr create -f --head main --base versioned - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Set PR to merge automatically - run: gh pr merge versioned --auto + - run: ./.github/scripts/copy_to_versioned.sh + shell: bash \ No newline at end of file