diff --git a/.github/workflows/maintainer-approved.yml b/.github/workflows/maintainer-approved.yml new file mode 100644 index 0000000000000..d3938320c3a42 --- /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: ubuntu-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 /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 }}