Skip to content

adding coderabbitai-review.yml #2

adding coderabbitai-review.yml

adding coderabbitai-review.yml #2

##############################################################################
##############################################################################
#
# NOTE!
#
# Please read the README.md file in this directory that defines what should
# be placed in this file
#
##############################################################################
##############################################################################
name: PR Review Status Trigger
on:
pull_request_review:
types: [submitted]
pull_request:
types: [opened, synchronize]
jobs:
pr-approval-trigger:
runs-on: ubuntu-latest
steps:
- name: Check if PR has been approved by CodeRabbit.ai
if: ${{ github.event_name == 'pull_request_review' && github.event.review.state == 'approved' }}
run: echo "This PR was approved by CodeRabbit.ai"
- name: Fail if PR is not approved by CodeRabbit.ai
if: ${{ github.event_name == 'pull_request_review' && github.event.review.state != 'approved' }}
run: |
echo "This PR was not approved by CodeRabbit.ai"
exit 1 # Fail the workflow if the review is not approved
- name: Fail if PR has not been reviewed by CodeRabbit.ai
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "This PR has not yet been reviewed by CodeRabbit.ai"
exit 1 # Fail the workflow if no review has been submitted