From a0712244641ab0975d6b12a52b53bf5463c9ae0f Mon Sep 17 00:00:00 2001 From: Rin Kuryloski Date: Wed, 26 Apr 2023 09:25:15 +0200 Subject: [PATCH 1/2] Update the automation to bump erlang/elixir patches in CI so that the workflow fails if the branch already exists, instead of just skipping We had a period of many weeks where the elixir workflow was being skipped because the branch was left around after a PR was closed, so we want to avoid that in the future (cherry picked from commit bb6c50311f77b969066ea12b8e78945d2eb0d541) # Conflicts: # .github/workflows/update-elixir-patches.yaml # .github/workflows/update-otp-patches.yaml --- .github/workflows/update-elixir-patches.yaml | 24 ++++++++++++++------ .github/workflows/update-otp-patches.yaml | 24 ++++++++++++-------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.github/workflows/update-elixir-patches.yaml b/.github/workflows/update-elixir-patches.yaml index 9d956116357..49d54b8899a 100644 --- a/.github/workflows/update-elixir-patches.yaml +++ b/.github/workflows/update-elixir-patches.yaml @@ -17,17 +17,20 @@ jobs: - elixir_version: "1.14" name: '1_14' timeout-minutes: 10 + env: + branch: bump-elixir-${{ matrix.elixir_version }} steps: - name: CHECKOUT REPOSITORY uses: actions/checkout@v3 - - name: SKIP IF THE PR ALREADY EXISTS + - name: FAIL IF THE PR ALREADY EXISTS id: check-for-branch run: | set +e - git ls-remote --exit-code --heads origin bump-elixir-${{ matrix.elixir_version }} - echo "::set-output name=c::$?" + if git ls-remote --exit-code --heads origin ${{ env.branch }}; then + echo "Branch ${{ env.branch }} already exits" + exit 1 + fi - name: DETERMINE LATEST PATCH & SHA - if: steps.check-for-branch.outputs.c != 0 id: fetch-version run: | TAG_NAME=$(curl -s GET https://api.github.com/repos/elixir-lang/elixir/tags?per_page=100 \ @@ -47,10 +50,9 @@ jobs: exit 1 fi - echo "::set-output name=VERSION::${TAG_NAME#v}" - echo "::set-output name=SHA::${SHA}" + echo "VERSION=${TAG_NAME#v}" >> $GITHUB_OUTPUT + echo "SHA=${SHA}" >> $GITHUB_OUTPUT - name: MODIFY VERSION FILE - if: steps.check-for-branch.outputs.c != 0 run: | sudo npm install --global --silent @bazel/buildozer @@ -67,8 +69,12 @@ jobs: set -x git diff - name: CREATE PULL REQUEST +<<<<<<< HEAD if: steps.check-for-branch.outputs.c != 0 uses: peter-evans/create-pull-request@v4.2.3 +======= + uses: peter-evans/create-pull-request@v5.0.0 +>>>>>>> bb6c50311f (Update the automation to bump erlang/elixir patches in CI) with: token: ${{ secrets.REPO_SCOPED_TOKEN }} committer: GitHub @@ -84,6 +90,10 @@ jobs: labels: | backport-v3.11.x backport-v3.10.x +<<<<<<< HEAD backport-v3.9.x branch: bump-elixir-${{ matrix.elixir_version }} +======= + branch: ${{ env.branch }} +>>>>>>> bb6c50311f (Update the automation to bump erlang/elixir patches in CI) delete-branch: true diff --git a/.github/workflows/update-otp-patches.yaml b/.github/workflows/update-otp-patches.yaml index d7ca6c610c5..3051a31323c 100644 --- a/.github/workflows/update-otp-patches.yaml +++ b/.github/workflows/update-otp-patches.yaml @@ -48,19 +48,22 @@ jobs: backport-v3.11.x backport-v3.10.x timeout-minutes: 10 + env: + branch: bump-otp-${{ matrix.erlang_version }} steps: - name: CHECKOUT REPOSITORY uses: actions/checkout@v3 with: ref: ${{ matrix.branch }} - - name: SKIP IF THE PR ALREADY EXISTS + - name: FAIL IF THE PR ALREADY EXISTS id: check-for-branch run: | set +e - git ls-remote --exit-code --heads origin bump-otp-${{ matrix.erlang_version }} - echo "::set-output name=c::$?" + if git ls-remote --exit-code --heads origin ${{ env.branch }}; then + echo "Branch ${{ env.branch }} already exits" + exit 1 + fi - name: DETERMINE LATEST PATCH & SHA - if: steps.check-for-branch.outputs.c != 0 id: fetch-version run: | TAG_NAME=$(curl -s GET https://api.github.com/repos/erlang/otp/tags?per_page=100 \ @@ -90,11 +93,10 @@ jobs: exit 1 fi - echo "::set-output name=VERSION::${VERSION}" - echo "::set-output name=SHA::${SHA}" - echo "::set-output name=SHA2::${SHA2}" + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + echo "SHA=${SHA}" >> $GITHUB_OUTPUT + echo "SHA2=${SHA2}" >> $GITHUB_OUTPUT - name: MODIFY VERSION FILE - if: steps.check-for-branch.outputs.c != 0 run: | sudo npm install --global --silent @bazel/buildozer @@ -141,8 +143,12 @@ jobs: set -x git diff - name: CREATE PULL REQUEST +<<<<<<< HEAD if: steps.check-for-branch.outputs.c != 0 uses: peter-evans/create-pull-request@v4.2.3 +======= + uses: peter-evans/create-pull-request@v5.0.0 +>>>>>>> bb6c50311f (Update the automation to bump erlang/elixir patches in CI) with: token: ${{ secrets.REPO_SCOPED_TOKEN }} committer: GitHub @@ -156,5 +162,5 @@ jobs: commit-message: | Adopt otp ${{ steps.fetch-version.outputs.VERSION }} labels: ${{ matrix.labels }} - branch: bump-otp-${{ matrix.erlang_version }} + branch: ${{ env.branch }} delete-branch: true From 476f15d5cad4731be1f0f6a1aa0e3b495120205b Mon Sep 17 00:00:00 2001 From: Rin Kuryloski Date: Wed, 26 Apr 2023 10:28:20 +0200 Subject: [PATCH 2/2] Fixup backport --- .github/workflows/update-elixir-patches.yaml | 10 ---------- .github/workflows/update-otp-patches.yaml | 5 ----- 2 files changed, 15 deletions(-) diff --git a/.github/workflows/update-elixir-patches.yaml b/.github/workflows/update-elixir-patches.yaml index 49d54b8899a..4e7556e613b 100644 --- a/.github/workflows/update-elixir-patches.yaml +++ b/.github/workflows/update-elixir-patches.yaml @@ -69,12 +69,7 @@ jobs: set -x git diff - name: CREATE PULL REQUEST -<<<<<<< HEAD - if: steps.check-for-branch.outputs.c != 0 - uses: peter-evans/create-pull-request@v4.2.3 -======= uses: peter-evans/create-pull-request@v5.0.0 ->>>>>>> bb6c50311f (Update the automation to bump erlang/elixir patches in CI) with: token: ${{ secrets.REPO_SCOPED_TOKEN }} committer: GitHub @@ -90,10 +85,5 @@ jobs: labels: | backport-v3.11.x backport-v3.10.x -<<<<<<< HEAD - backport-v3.9.x - branch: bump-elixir-${{ matrix.elixir_version }} -======= branch: ${{ env.branch }} ->>>>>>> bb6c50311f (Update the automation to bump erlang/elixir patches in CI) delete-branch: true diff --git a/.github/workflows/update-otp-patches.yaml b/.github/workflows/update-otp-patches.yaml index 3051a31323c..0a20080e88f 100644 --- a/.github/workflows/update-otp-patches.yaml +++ b/.github/workflows/update-otp-patches.yaml @@ -143,12 +143,7 @@ jobs: set -x git diff - name: CREATE PULL REQUEST -<<<<<<< HEAD - if: steps.check-for-branch.outputs.c != 0 - uses: peter-evans/create-pull-request@v4.2.3 -======= uses: peter-evans/create-pull-request@v5.0.0 ->>>>>>> bb6c50311f (Update the automation to bump erlang/elixir patches in CI) with: token: ${{ secrets.REPO_SCOPED_TOKEN }} committer: GitHub