From 072bb8af11782185623cc296b74207ed92aedc6f 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 | 36 +++++++++++++++++++++++ 1 file changed, 36 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..5a480852ddde4 --- /dev/null +++ b/.github/workflows/maintainer-approved.yml @@ -0,0 +1,36 @@ +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: ubunut-latest + steps: + - id: find-maintainers + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + const maintainersList = await github.request('GET GET /repos/{owner}/{repo}/collaborators', { + owner: 'OWNER', + repo: 'REPO', + repository_id: 'my-repoid', + permission: 'maintain', + affiliation: 'all', + per_page: 100 + }); + + console.log(JSON.stringify(maintainersList)); + return "a, b, c" + + - uses: peternied/approved-by-maintainers@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + min-required: 1 + maintainers: ${{ steps.find-maintainers.outputs.result }}