diff --git a/.github/workflows/governance_pull_request_template.yml b/.github/workflows/governance_pull_request_template.yml index 880dd81b044..7012f8b1d14 100644 --- a/.github/workflows/governance_pull_request_template.yml +++ b/.github/workflows/governance_pull_request_template.yml @@ -11,36 +11,27 @@ jobs: mainJob: runs-on: ubuntu-latest steps: - - - name: Is the Author in nns-team? - uses: actions/github-script@v6 - id: isAuthorInNnsTeam + - uses: actions/github-script@v6 + id: mainStep with: - github-token: ${{ secrets.CLA_BOT_PRIVATE_KEY }} + github-token: ${{ secrets.GITHUB_TOKEN }} retries: 3 script: | - /* DO NOT MERGE const pullRequestNumber = context.payload.number; - console.log("Calling listMembersInOrg...") - const nnsTeamMembers = await await github.rest.teams.listMembersInOrg({ - org: "dfinity", - team_slug: "nns-team", - }); - console.log("nnsTeamMemebrs = " + JSON.stringify(nnsTeamMembers)); - const isInNnsTeam = nnsTeamMembers.data.some(member => member.login == context.actor); - */ - const isInNnsTeam = true; - console.log("Is actor in nns-team? " + isInNnsTeam); + // Only remind if nns-team approval is required. + const reviews = await octokit.pulls.getReviews({ + owner: "dfinity", + repo: "ic", + pull_number: pullRequestNumber, + }); + console.log("reviews = " + JSON.stringify(reviews)); + const requiredTeams = reviews.data.required_pull_request_reviews; + const nnsTeamApprovalRequired = requiredTeams.some((team) => team.team_id === 'nns-team'); + if (!nnsTeamApprovalRequired) { + return; + } - - name: Remind the Author to Update unreleased_changes.md. - uses: actions/github-script@v6 - if: steps.isAuthorInNnsTeam.outputs.isInNnsTeam == 'true' - id: remindAuthorToUpdateUnreleasedChangelog - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - retries: 3 - script: | // TODO: Figure out how to post in such a way that there is a "Resolve" button nearby. await github.rest.pulls.createReview({ owner: "dfinity",