From 6ebf6775db36a0fbcfcfc9829dda8825e5a15aa8 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Thu, 7 Dec 2023 14:48:38 -0600 Subject: [PATCH] [Backport 1.x] Maintainer approval check (#11378) Signed-off-by: Peter Nied Signed-off-by: Peter Nied (cherry picked from commit 87b30118673db54611078b3a8aaede20082ff59a) --- .github/workflows/maintainer-approval.yml | 33 +++++++++++++++++++++++ CHANGELOG.md | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/maintainer-approval.yml diff --git a/.github/workflows/maintainer-approval.yml b/.github/workflows/maintainer-approval.yml new file mode 100644 index 0000000000000..2f87afd372d90 --- /dev/null +++ b/.github/workflows/maintainer-approval.yml @@ -0,0 +1,33 @@ +name: Maintainers approval + +on: + pull_request_review: + types: [submitted] + +jobs: + maintainer-approved-check: + name: Minimum approval count + runs-on: ubuntu-latest + steps: + - id: find-maintainers + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + // Get the collaborators - filtered to maintainer permissions + const maintainersResponse = await github.request('GET /repos/{owner}/{repo}/collaborators', { + owner: context.repo.owner, + repo: context.repo.repo, + permission: 'maintain', + affiliation: 'all', + per_page: 100 + }); + + return maintainersResponse.data.map(item => item.login).join(', '); + + - uses: peternied/required-approval@v1.2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + min-required: 1 + required-approvers-list: ${{ steps.find-maintainers.outputs.result }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 099e86b79e4ad..acf7baa41ecea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased 1.x] ### Added +- Maintainer approval check ([#11378](https://github.com/opensearch-project/OpenSearch/pull/11378)) + ### Dependencies - Bump `netty` from 4.1.96.Final to 4.1.97.Final ([#9553](https://github.com/opensearch-project/OpenSearch/pull/9553)) - Bump `netty` from 4.1.100.Final to 4.1.101.Final ([#11294](https://github.com/opensearch-project/OpenSearch/pull/11294))