From 19b3e3b084588f3c1f40f83448cbc9318a77c264 Mon Sep 17 00:00:00 2001 From: omkarkhatavkar Date: Wed, 24 Jul 2024 21:26:01 +0530 Subject: [PATCH] making auto-merge should be same as master --- ...merge.yaml => auto_cherry_pick_merge.yaml} | 70 +++++-------------- 1 file changed, 16 insertions(+), 54 deletions(-) rename .github/workflows/{automerge.yaml => auto_cherry_pick_merge.yaml} (54%) diff --git a/.github/workflows/automerge.yaml b/.github/workflows/auto_cherry_pick_merge.yaml similarity index 54% rename from .github/workflows/automerge.yaml rename to .github/workflows/auto_cherry_pick_merge.yaml index 0e51739ee..83514413e 100644 --- a/.github/workflows/automerge.yaml +++ b/.github/workflows/auto_cherry_pick_merge.yaml @@ -8,11 +8,6 @@ on: - ready_for_review branches-ignore: - master - pull_request_review: - types: - - submitted - branches-ignore: - - master check_suite: types: - completed @@ -28,7 +23,7 @@ jobs: steps: - id: find-prt-comment name: Find the prt comment - uses: peter-evans/find-comment@v2 + uses: peter-evans/find-comment@v3 with: issue-number: ${{ github.event.number }} body-includes: "trigger: test-robottelo" @@ -45,7 +40,7 @@ jobs: - name: Wait for other status checks to Pass id: waitforstatuschecks - uses: lewagon/wait-on-check-action@v1.2.0 + uses: lewagon/wait-on-check-action@v1.3.4 with: ref: ${{ github.head_ref }} repo-token: ${{ secrets.CHERRYPICK_PAT }} @@ -53,65 +48,32 @@ jobs: running-workflow-name: 'Automerge auto-cherry-picked pr' allowed-conclusions: success,skipped - - name: is PRT check Passed ? - run: | - api_endpoint="https://api.github.com/repos/${{github.repository}}/statuses/${{ github.head_ref }}" - - function get_status() { - curl -s "$api_endpoint" | jq '[.[] | .state] | .[0]' - } - - function get_context() { - curl -s "$api_endpoint" | jq '[.[] | .context] | .[0]' - } - - statuses_length=$(curl -s $api_endpoint | jq 'length') - if [ $statuses_length -eq 0 ]; then - echo "PRT failed to start ! Stopping." - exit 1 - fi - - status=$(get_status) - context=$(get_context) - - if [ "$context" != "Robottelo-Runner" ]; then - echo "::error Failed to get Robottelo-Runner status" - exit 1 - fi - - counter=0 - echo "Waiting for PRT to complete....." - while [ "$status" != "success" ] && [ "$status" != "failure" ]; do - if [ $counter -gt 20 ]; then - echo "PRT Timeout" - exit 1 - fi - sleep 300 - status=$(get_status) - echo "Robottelo-Runner : $status" - counter=$((counter+1)) - done + - name: Fetch the PRT status + id: outcome + uses: omkarkhatavkar/wait-for-status-checks@main + with: + ref: ${{ github.event.pull_request.head.sha }} + context: 'Airgun-Runner' + wait-interval: 60 + count: 100 - if [ "$status" == "success" ]; then - echo "PRT Passed Successfully!" + - name: Check the PRT status + run: | + if [ ${{ steps.outcome.outputs.result }} == 'success' ]; then + echo "Status check passed!" else - echo "Robottelo-Runner : $status" - echo "::error PRT failed" - exit 1 + echo "Status check failed!" fi - - id: automerge name: Auto merge of cherry-picked PRs. - uses: "pascalgn/automerge-action@v0.15.5" - if: steps.waitforstatuschecks.outputs.status == 'success' + uses: "pascalgn/automerge-action@v0.16.3" env: GITHUB_TOKEN: "${{ secrets.CHERRYPICK_PAT }}" MERGE_LABELS: "AutoMerge_Cherry_Picked, Auto_Cherry_Picked" MERGE_METHOD: "squash" MERGE_RETRIES: 5 MERGE_RETRY_SLEEP: 900000 - BASE_BRANCHES: "master" # avoid automerge branch - name: Auto Merge Status run: |