From 949a66227821706da437ebcdc8319619e734c62b Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Fri, 17 Jan 2025 10:47:39 +0100 Subject: [PATCH] Update Signed-off-by: Alina Buzachis --- .github/workflows/check_backports.yml | 32 +++++++++------------------ 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/.github/workflows/check_backports.yml b/.github/workflows/check_backports.yml index c7ca68a8c75..66487c317e0 100644 --- a/.github/workflows/check_backports.yml +++ b/.github/workflows/check_backports.yml @@ -1,31 +1,19 @@ -name: Detect Patchback Bot Backport Failures +name: Check Patchback Comment on Edit on: - pull_request: - branches: - - main + issue_comment: types: - - closed + - edited jobs: - detect_backport_failure: - if: github.event.pull_request.merged == true # Only run for merged PRs + check_patchback_comment: + if: > + github.event.issue.pull_request.merged == true && + github.event.comment.user.login == 'patchback' && + contains(github.event.comment.body, '💔 cherry-picking failed') runs-on: ubuntu-latest steps: - - name: Check for Patchback Bot Comments - id: check_comments - shell: bash + - name: Add Label for Backport Failure run: | - # Check if the comment exists from patchback with the specific failure text - comment_exists=$(gh pr view ${{ github.event.pull_request.number }} -R ${{ github.repository }} --json comments --jq '[.comments[] | select(.body and (.body | capture("💔 cherry-picking failed"))) ] | length > 0') - - # Output the result directly - echo "::set-output name=comment_exists::$comment_exists" - - - name: Add Backport Failed Label - if: steps.check_comment.outputs.comment_exists == 'true' # Run only if failure was detected - shell: bash - run: | - # Add the backport_failed label - gh pr edit ${{ github.event.pull_request.number }} --add-label "backport_failed" + gh pr edit ${{ github.event.issue.number }} -R ${{ github.repository }} --add-label 'backport-failed'