Skip to content

Commit

Permalink
Try AI suggestion for how to detect required approvals.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-wong-dfinity-org committed Jan 6, 2025
1 parent 665a4a0 commit da3eb99
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions .github/workflows/governance_pull_request_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit da3eb99

Please sign in to comment.