forked from ansible-collections/amazon.aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alina Buzachis <abuzachis@redhat.com>
- Loading branch information
1 parent
1b650b9
commit 949a662
Showing
1 changed file
with
10 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |