Skip to content

Commit

Permalink
fixed the auto-cherry-picking issue cause due github action failure (#…
Browse files Browse the repository at this point in the history
…14016)

fixed the auto-cherry-picking issue cause due git-hub action failure
  • Loading branch information
omkarkhatavkar authored Feb 12, 2024
1 parent 2d0fed6 commit 66a62d9
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:

- name: Add Parent PR's PRT comment to Auto_Cherry_Picked PR's
id: add-parent-prt-comment
if: ${{ always() && steps.cherrypick.outcome == 'success' }}
if: ${{ always() && needs.find-the-parent-prt-comment.outputs.prt_comment != '' && steps.cherrypick.outcome == 'success' }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Expand All @@ -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 }}] ${{ env.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
## Failure Logging to issues
- 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 == 'false' && steps.cherrypick.outcome != 'success' && startsWith(matrix.label, '6.') && matrix.label != github.base_ref }}
uses: dacbd/create-issue-action@main
with:
token: ${{ secrets.CHERRYPICK_PAT }}
Expand Down

0 comments on commit 66a62d9

Please sign in to comment.