From f5c9b1a6c20eb9584309aa83a1672405fd6c1087 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 10:30:17 +0200 Subject: [PATCH 1/2] Update the automation to bump erlang/elixir patches in CI (backport #7991) (#7996) * 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 * Fixup backport --------- Co-authored-by: Rin Kuryloski (cherry picked from commit d59a1db01c9f548746fd5a8220dac2728d85e85d) # Conflicts: # .github/workflows/update-elixir-patches.yaml # .github/workflows/update-otp-patches.yaml --- .github/workflows/update-elixir-patches.yaml | 23 ++++++++++++++------ .github/workflows/update-otp-patches.yaml | 23 ++++++++++++-------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.github/workflows/update-elixir-patches.yaml b/.github/workflows/update-elixir-patches.yaml index 787e96194db9..57e27c112ce1 100644 --- a/.github/workflows/update-elixir-patches.yaml +++ b/.github/workflows/update-elixir-patches.yaml @@ -16,17 +16,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 \ @@ -46,10 +49,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 @@ -66,7 +68,10 @@ jobs: set -x git diff - name: CREATE PULL REQUEST +<<<<<<< HEAD if: steps.check-for-branch.outputs.c != 0 +======= +>>>>>>> d59a1db01c (Update the automation to bump erlang/elixir patches in CI (backport #7991) (#7996)) uses: peter-evans/create-pull-request@v5.0.0 with: token: ${{ secrets.REPO_SCOPED_TOKEN }} @@ -78,7 +83,11 @@ jobs: labels: | backport-v3.11.x backport-v3.10.x +<<<<<<< HEAD backport-v3.9.x backport-v3.8.x branch: bump-elixir-${{ matrix.elixir_version }} +======= + branch: ${{ env.branch }} +>>>>>>> d59a1db01c (Update the automation to bump erlang/elixir patches in CI (backport #7991) (#7996)) delete-branch: true diff --git a/.github/workflows/update-otp-patches.yaml b/.github/workflows/update-otp-patches.yaml index 76ecdf156933..f461a4e8d813 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,7 +143,10 @@ jobs: set -x git diff - name: CREATE PULL REQUEST +<<<<<<< HEAD if: steps.check-for-branch.outputs.c != 0 +======= +>>>>>>> d59a1db01c (Update the automation to bump erlang/elixir patches in CI (backport #7991) (#7996)) uses: peter-evans/create-pull-request@v5.0.0 with: token: ${{ secrets.REPO_SCOPED_TOKEN }} @@ -156,5 +161,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 379abcfd8194b91bc593fa742140d688e412300b Mon Sep 17 00:00:00 2001 From: Rin Kuryloski Date: Wed, 26 Apr 2023 11:02:41 +0200 Subject: [PATCH 2/2] Fixup backport --- .github/workflows/update-elixir-patches.yaml | 13 ------------- .github/workflows/update-otp-patches.yaml | 4 ---- 2 files changed, 17 deletions(-) diff --git a/.github/workflows/update-elixir-patches.yaml b/.github/workflows/update-elixir-patches.yaml index 57e27c112ce1..3168fa9d1635 100644 --- a/.github/workflows/update-elixir-patches.yaml +++ b/.github/workflows/update-elixir-patches.yaml @@ -68,10 +68,6 @@ jobs: set -x git diff - name: CREATE PULL REQUEST -<<<<<<< HEAD - if: steps.check-for-branch.outputs.c != 0 -======= ->>>>>>> d59a1db01c (Update the automation to bump erlang/elixir patches in CI (backport #7991) (#7996)) uses: peter-evans/create-pull-request@v5.0.0 with: token: ${{ secrets.REPO_SCOPED_TOKEN }} @@ -80,14 +76,5 @@ jobs: title: Adopt elixir ${{ steps.fetch-version.outputs.VERSION }} commit-message: | Adopt elixir ${{ steps.fetch-version.outputs.VERSION }} - labels: | - backport-v3.11.x - backport-v3.10.x -<<<<<<< HEAD - backport-v3.9.x - backport-v3.8.x - branch: bump-elixir-${{ matrix.elixir_version }} -======= branch: ${{ env.branch }} ->>>>>>> d59a1db01c (Update the automation to bump erlang/elixir patches in CI (backport #7991) (#7996)) delete-branch: true diff --git a/.github/workflows/update-otp-patches.yaml b/.github/workflows/update-otp-patches.yaml index f461a4e8d813..0a20080e88f8 100644 --- a/.github/workflows/update-otp-patches.yaml +++ b/.github/workflows/update-otp-patches.yaml @@ -143,10 +143,6 @@ jobs: set -x git diff - name: CREATE PULL REQUEST -<<<<<<< HEAD - if: steps.check-for-branch.outputs.c != 0 -======= ->>>>>>> d59a1db01c (Update the automation to bump erlang/elixir patches in CI (backport #7991) (#7996)) uses: peter-evans/create-pull-request@v5.0.0 with: token: ${{ secrets.REPO_SCOPED_TOKEN }}