From 2da74781ffe90c93afc758990ed52046c6318f73 Mon Sep 17 00:00:00 2001 From: omkarkhatavkar Date: Thu, 31 Aug 2023 13:34:07 +0530 Subject: [PATCH] fixed the diff between gha robottelo and airgun --- .github/workflows/auto_cherry_pick.yml | 5 +- .github/workflows/automerge.yaml | 123 ------------------------- 2 files changed, 3 insertions(+), 125 deletions(-) delete mode 100644 .github/workflows/automerge.yaml diff --git a/.github/workflows/auto_cherry_pick.yml b/.github/workflows/auto_cherry_pick.yml index 1acdc38ea..a495b50b2 100644 --- a/.github/workflows/auto_cherry_pick.yml +++ b/.github/workflows/auto_cherry_pick.yml @@ -3,7 +3,7 @@ name: auto_cherry_pick_commits on: pull_request_target: - types: [closed, labeled] + types: [closed] # Github & Parent PR Env vars env: @@ -27,6 +27,7 @@ jobs: with: issue-number: ${{ env.number }} body-includes: "trigger: test-robottelo" + direction: last # Auto CherryPicking and Failure Recording auto-cherry-pick: @@ -84,7 +85,7 @@ jobs: ## Failure Logging to issues and GChat Group - name: Create Github issue on cherrypick failure id: create-issue - if: ${{ always() && steps.cherrypick.outcome == 'failure' }} + if: ${{ always() && steps.cherrypick.outcome != 'success' && startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} uses: dacbd/create-issue-action@main with: token: ${{ secrets.CHERRYPICK_PAT }} diff --git a/.github/workflows/automerge.yaml b/.github/workflows/automerge.yaml deleted file mode 100644 index 0e51739ee..000000000 --- a/.github/workflows/automerge.yaml +++ /dev/null @@ -1,123 +0,0 @@ -name: automerge auto-cherry-picked pr's -on: - pull_request_target: - types: - - labeled - - unlabeled - - edited - - ready_for_review - branches-ignore: - - master - pull_request_review: - types: - - submitted - branches-ignore: - - master - check_suite: - types: - - completed - branches-ignore: - - master - - -jobs: - automerge: - name: Automerge auto-cherry-picked pr - if: contains(github.event.pull_request.labels.*.name, 'AutoMerge_Cherry_Picked') && contains(github.event.pull_request.labels.*.name, 'Auto_Cherry_Picked') - runs-on: ubuntu-latest - steps: - - id: find-prt-comment - name: Find the prt comment - uses: peter-evans/find-comment@v2 - with: - issue-number: ${{ github.event.number }} - body-includes: "trigger: test-robottelo" - direction: last - - - name: Fail automerge if PRT was not initiated - if: steps.find-prt-comment.outputs.comment-body == '' - run: | - echo "::error PRT comment not added the PR" - - - name: Wait for PRT checks to get initiated - run: | - echo "Waiting for ~ 10 mins, PRT to be initiated." && sleep 600 - - - name: Wait for other status checks to Pass - id: waitforstatuschecks - uses: lewagon/wait-on-check-action@v1.2.0 - with: - ref: ${{ github.head_ref }} - repo-token: ${{ secrets.CHERRYPICK_PAT }} - wait-interval: 60 - 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 - - if [ "$status" == "success" ]; then - echo "PRT Passed Successfully!" - else - echo "Robottelo-Runner : $status" - echo "::error PRT failed" - exit 1 - fi - - - - id: automerge - name: Auto merge of cherry-picked PRs. - uses: "pascalgn/automerge-action@v0.15.5" - if: steps.waitforstatuschecks.outputs.status == 'success' - 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: | - if [ "${{ steps.automerge.outputs.mergeResult }}" == 'merged' ]; then - echo "Pull request ${{ steps.automerge.outputs.pullRequestNumber }} is Auto Merged !" - else - echo "::error Auto Merge for Pull request failed !" - exit 1 - fi