adding coderabbitai-review.yml #2
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
############################################################################## | |
############################################################################## | |
# | |
# 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 |