diff --git a/.github/workflows/check-reviews.yaml b/.github/workflows/check-reviews.yaml new file mode 100644 index 000000000..fe93e5475 --- /dev/null +++ b/.github/workflows/check-reviews.yaml @@ -0,0 +1,31 @@ +name: Check Reviews + +on: + pull_request: + types: [opened, edited, reopened] + +jobs: + review-check: + runs-on: ubuntu-latest + steps: + - name: Check for required reviews + uses: actions/github-script@v6 + with: + script: | + try { + console.log('GitHub context:', context); + const { pull_request } = context.payload; + const reviews = await github.pulls.listReviews({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pull_request.number, + }); + const approvedReviews = reviews.data.filter(review => review.state === 'APPROVED'); + if (approvedReviews.length === 0) { + throw new Error('This pull request requires at least one approved review before merging.'); + } + } catch (error) { + console.error('Error fetching reviews:', error); + throw new Error('Failed to check reviews: ' + error.message); + } + \ No newline at end of file diff --git a/README.md b/README.md index fe7613352..016cfeb01 100644 --- a/README.md +++ b/README.md @@ -150,3 +150,4 @@ $ docker push //quay-operator-index:dev ```sh $ kubectl create -n openshift-marketplace -f ./bundle/quay-operator.catalogsource.yaml ``` +# Test Change