Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: allow merge without 2-person review #81

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/allow_merge_without_2pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
pull_request:
branches:
- main
pull_request_review:
types: [submitted]

name: Allow merge without approval

jobs:
build:
name: Test
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: actions/checkout@v3
- run: git fetch origin ${{ github.base_ref }} --depth=1

- name: Checks if files can be merged without approval.
id: check-diff
if: github.event.review.state != 'approved'
run: |
diffs=$(git diff --name-only origin/${{ github.base_ref }} HEAD | grep -e "_test.go" -e "\.md" -e "\.github/" -e "examples/" -e "definitions/")
echo "$diffs"
echo "REVIEW_REQUIRED_FILES=\"$diffs\"" >> "$GITHUB_OUTPUT"
[[ "$diffs" == "" ]]

- if: failure()
uses: actions/github-script@v6
permissions:
pull-requests: write
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '[Review Required]\n{{ steps.check-diff.outputs.REVIEW_REQUIRED_FILES }}'
})
Loading