Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xDEnYO committed Aug 13, 2024
1 parent 1190a6a commit 3385b5f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/protectAuditorsGroup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Protect Auditors Group

on:
push:

jobs:
check_membership:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check Group Membership Overlap
uses: actions/github-script@v7
with:
script: |
const ORG_NAME = 'lifinance';
const GROUP_A = 'smart-contract-core';
const GROUP_B = 'smart-contract-admins';
const GROUP_C = 'auditors';
async function getTeamMembers(org, teamSlug) {
const members = [];
let page = 1;
while (true) {
const { data } = await github.rest.teams.listMembersInOrg({
org,
team_slug: teamSlug,
per_page: 100,
page
});
members.push(...data.map(member => member.login));
if (data.length < 100) break;
page++;
}
return members;
}
async function run() {
const groupAMembers = await getTeamMembers(ORG_NAME, GROUP_A);
const groupBMembers = await getTeamMembers(ORG_NAME, GROUP_B);
const groupCMembers = await getTeamMembers(ORG_NAME, GROUP_C);
// check overlap between smart-contract-core and auditors
const overlap = groupAMembers.filter(member => groupCMembers.includes(member));
if (overlap.length > 0) {
core.setFailed(`ERROR: The following members are in both ${GROUP_A} and ${GROUP_C}: ${overlap.join(', ')}`);
} else {
core.info(`No overlap found between ${GROUP_A} and ${GROUP_B}.`);
}
// check overlap between smart-contract-admins and auditors
const overlap = groupBMembers.filter(member => groupCMembers.includes(member));
if (overlap.length > 0) {
core.setFailed(`ERROR: The following members are in both ${GROUP_B} and ${GROUP_C}: ${overlap.join(', ')}`);
} else {
core.info(`No overlap found between ${GROUP_A} and ${GROUP_B}.`);
}
}
await run();
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.

0 comments on commit 3385b5f

Please sign in to comment.