From c635b8e0524307d293d0456c65515b761c3d8388 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Sat, 18 Nov 2023 08:51:44 +0300 Subject: [PATCH] fix: more robust date detection in automerge-transifex-app-prs.yml use bash if-statement to check for null instead of throwing JavaScript after attempting to parse a null date. --- .github/workflows/automerge-transifex-app-prs.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/automerge-transifex-app-prs.yml b/.github/workflows/automerge-transifex-app-prs.yml index 20af43adcc7..67c08bd209c 100644 --- a/.github/workflows/automerge-transifex-app-prs.yml +++ b/.github/workflows/automerge-transifex-app-prs.yml @@ -35,6 +35,12 @@ jobs: # 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' + MERGE_DATE="$(gh pr view "$PR_NUMBER" --json mergedAt --jq '.mergedAt')" + + if [ -n "$MERGE_DATE" ]; then + echo "Success: PR merged at '$MERGE_DATE'" + exit 0 + else + echo "PR not merged yet, retrying via 'nick-fields/retry'..." + exit 1 + fi