From 90d7235c996bd7ff66366a84e717e95b3e5fb967 Mon Sep 17 00:00:00 2001 From: omkarkhatavkar Date: Thu, 8 Feb 2024 18:36:59 +0530 Subject: [PATCH] fixed the auto-cherry-picking issue cause due git-hub action failure --- .github/workflows/auto_cherry_pick.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/auto_cherry_pick.yml b/.github/workflows/auto_cherry_pick.yml index 953d403df87..b352f478447 100644 --- a/.github/workflows/auto_cherry_pick.yml +++ b/.github/workflows/auto_cherry_pick.yml @@ -98,17 +98,24 @@ jobs: }) - name: Check if cherrypick pr is created - uses: juliangruber/find-pull-request-action@v1 - id: fpr + id: search_pr if: always() - with: - branch: "cherry-pick-${{ matrix.label }}-${{ github.sha }}" - base: ${{ matrix.label }} + run: | + PR_TITLE="[${{ matrix.label }}] ${{ github.event.inputs.pr_title }}" + API_URL="https://api.github.com/repos/${{ github.repository }}/pulls?state=open" + PR_SEARCH_RESULT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$API_URL" | jq --arg title "$PR_TITLE" '.[] | select(.title == $title)') + if [ -n "$PR_SEARCH_RESULT" ]; then + echo "pr_found=true" >> $GITHUB_OUTPUT + echo "PR is Found with title $PR_TITLE" + else + echo "pr_found=false" >> $GITHUB_OUTPUT + echo "PR is not Found with title $PR_TITLE" + fi ## Failure Logging to issues and GChat Group - name: Create Github issue on cherrypick failure id: create-issue - if: ${{ always() && steps.fpr.outputs.number != '' && steps.cherrypick.outcome != 'success' && startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} + if: ${{ always() && steps.search_pr.outputs.pr_found == 'true' && steps.cherrypick.outcome != 'success' && startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} uses: dacbd/create-issue-action@main with: token: ${{ secrets.CHERRYPICK_PAT }}