]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
.github: Fix cherry-pick reminder issues
authorGeorge Joseph <gjoseph@sangoma.com>
Mon, 17 Jul 2023 15:23:08 +0000 (09:23 -0600)
committerGeorge Joseph <gjoseph@sangoma.com>
Mon, 9 Oct 2023 14:53:56 +0000 (08:53 -0600)
.github/workflows/PROpenedOrUpdated.yml

index 1ed299f9cfa78d50f3e420e68c7f7b9edbb5cf98..84e230053399a13d37df482ca13d985b8d7b4a8e 100644 (file)
@@ -20,6 +20,13 @@ jobs:
     if: ${{ github.event.label.name == vars.PR_ACCEPTANCE_TEST_LABEL }}
     runs-on: ubuntu-latest
     steps:
+      - name: Job Start Delay
+        env:
+          JOB_START_DELAY_SEC:       ${{vars.PR_JOB_START_DELAY_SEC}}
+        run: |
+          # Give the user a chance to add their "cherry-pick-to" comments
+          sleep ${JOB_START_DELAY_SEC:-60}
+
       - name: Get Token needed to add reviewers
         if: github.event.action == 'opened'
         id: get_workflow_token
@@ -39,12 +46,17 @@ jobs:
           github_token:            ${{secrets.GITHUB_TOKEN}}
 
       - name: Add cherry-pick reminder
-        if: ${{ steps.getbranches.outputs.branch_count == 0 || steps.getbranches.outputs.forced_none != 'true' }}
         env:
           GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
           GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
           CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
+          BRANCHES_OUTPUT: ${{toJSON(steps.getbranches.outputs)}}
+          BRANCH_COUNT: ${{steps.getbranches.outputs.branch_count}}
+          FORCED_NONE:  ${{steps.getbranches.outputs.forced_none}}
         run: |
+          # If the user already added "cherry-pick-to" comments
+          # we don't need to remind them.
+          ( $FORCED_NONE || [ $BRANCH_COUNT -gt 0 ] ) && { echo "No reminder needed." ; exit 0 ; }
           IFS=$'; \n'
           # If there's already a reminder comment, don't add another one.
           ADD_COMMENT=true