From 01a01456235a24d39d2b19501ca55480e1174549 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Sat, 18 Nov 2023 08:36:10 +0300 Subject: [PATCH] fix: revert: avoid failing the automerge-transifex-app-prs.yml This reverts commit 854ceef60fdeb48cab6087df34f7a1c9722632b5. There has been new failures which prevented such as: > GraphQL: Pull request Pull request is in unstable status (enablePullRequestAutoMerge) as well as the interminent error of: > auto-merge was automatically disabled yesterday > Base branch was modified This effectively brings back both #222 and #225 --- .../workflows/automerge-transifex-app-prs.yml | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/automerge-transifex-app-prs.yml b/.github/workflows/automerge-transifex-app-prs.yml index 5df24a43cb5..f368dd54465 100644 --- a/.github/workflows/automerge-transifex-app-prs.yml +++ b/.github/workflows/automerge-transifex-app-prs.yml @@ -15,15 +15,26 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 - - - name: Auto-merge pull request + - name: merge pull request + uses: nick-fields/retry@v2 + id: mergePR env: # secrets can't be used in job conditionals, so we set them to env here TRANSIFEX_APP_ACTOR_NAME: "${{ secrets.TRANSIFEX_APP_ACTOR_NAME }}" TRANSIFEX_APP_ACTOR_ID: "${{ secrets.TRANSIFEX_APP_ACTOR_ID }}" # This token requires Write access to the openedx-translations repo GITHUB_TOKEN: ${{ secrets.EDX_TRANSIFEX_BOT_GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.number }} if: "${{ github.actor == env.TRANSIFEX_APP_ACTOR_NAME && github.actor_id == env.TRANSIFEX_APP_ACTOR_ID }}" - run: | - # Add the pull request to the merge queue with --rebase commit strategy - gh pr merge ${{ github.head_ref }} --rebase --auto + with: + retry_wait_seconds: 60 + max_attempts: 5 + timeout_minutes: 15 + retry_on: error + command: | + # Attempt to merge the PR + gh pr merge ${{ github.head_ref }} --rebase --auto + + # The `fromdate | todate` are used merge to validate that `mergedAt` isn't null + # therefore verifying that the pull request was merged successfully. + gh pr view "$PR_NUMBER" --json mergedAt --jq '.mergedAt | fromdate | todate'