Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Signed-off-by: Alina Buzachis <abuzachis@redhat.com>
  • Loading branch information
alinabuzachis committed Jan 17, 2025
1 parent 1b650b9 commit 949a662
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/check_backports.yml
Original file line number Diff line number Diff line change
@@ -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'

0 comments on commit 949a662

Please sign in to comment.