From 2dbd4e419d9e65384aa4de8c5cc29557a0333715 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Tue, 28 Nov 2023 19:00:12 +0000 Subject: [PATCH] Add maintainer approval check Signed-off-by: Peter Nied --- .github/workflows/maintainer-approved.yml | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/maintainer-approved.yml diff --git a/.github/workflows/maintainer-approved.yml b/.github/workflows/maintainer-approved.yml new file mode 100644 index 0000000000000..56d98b848f12c --- /dev/null +++ b/.github/workflows/maintainer-approved.yml @@ -0,0 +1,34 @@ +name: Check if maintainers have approved this PR + +on: + pull_request_review: + types: [submitted] + + pull_request_target: + types: [opened, reopened] + +jobs: + maintainer-approved-check: + runs-on: ubuntu-latest + steps: + - id: find-maintainers + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + const maintainersResponse = await github.request('GET /repos/{owner}/{repo}/collaborators', { + owner: 'peternied', + repo: 'OpenSearch-1', + permission: 'maintain', + affiliation: 'all', + per_page: 100 + }); + + return maintainersResponse.data.map(item => item.login).join(', '); + + - uses: peternied/approved-by-maintainers@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + min-required: 1 + maintainers: ${{ steps.find-maintainers.outputs.result }}