66 issue_comment :
77 types : [created, edited]
88
9- permissions :
10- contents : read
11- issues : write
12-
139jobs :
1410 rfc_approval :
1511 # Only run for RFC proposal issues that are still open
2016 - name : Handle RFC approval logic
2117 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
2218 with :
23- github-token : ${{ secrets.GITHUB_TOKEN }}
19+ github-token : ${{ secrets.nf_core_bot_auth_token }}
2420 script : |
2521 const issueNumber = context.issue.number;
2622 const org = context.repo.owner;
@@ -30,21 +26,30 @@ jobs:
3026 // Fetch members of the core team
3127 // ---------------------------------------------
3228 async function getTeamMembers() {
33- const res = await github.request('GET /orgs/{org}/teams/{team_slug}/members', {
34- org,
35- team_slug: 'core',
36- per_page: 100
37- });
38- return res.data.map(m => m.login);
29+ try {
30+ const res = await github.request('GET /orgs/{org}/teams/{team_slug}/members', {
31+ org,
32+ team_slug: 'core',
33+ per_page: 100
34+ });
35+ console.log(`Fetched ${res.data.length} core team members.`);
36+ return res.data.map(m => m.login);
37+ } catch (err) {
38+ console.error('Failed to fetch core team members:', err);
39+ throw err;
40+ }
3941 }
4042
4143 const teamMembers = await getTeamMembers();
44+ console.log('Core team members:', teamMembers);
4245 const quorum = Math.ceil(teamMembers.length / 2);
46+ console.log(`Quorum set to ${quorum}.`);
4347
4448 // -------------------------------------------------
4549 // If this workflow was triggered by issue creation
4650 // -------------------------------------------------
4751 if (context.eventName === 'issues' && context.payload.action === 'opened') {
52+ console.log('Creating initial comment for review status');
4853 const body = `# RFC approval status: Pending\n\nCore team approvers:\nRejection from:\nAwaiting approval from:`;
4954
5055 await github.rest.issues.createComment({
6166 // ---------------------------------------------------------------------
6267
6368 // Collect all comments on the issue (may require pagination)
69+ console.log('Fetching issue comments');
6470 const comments = await github.paginate(github.rest.issues.listComments, {
6571 owner: org,
6672 repo,
@@ -87,10 +93,14 @@ jobs:
8793 }
8894 }
8995
96+ console.log(`Approvals (${approvals.size}):`, [...approvals]);
97+ console.log(`Rejections (${rejections.size}):`, [...rejections]);
98+
9099 const awaiting = teamMembers.filter(u => !approvals.has(u) && !rejections.has(u));
91100 const status = approvals.size >= quorum && rejections.size === 0 ? 'Approved' : 'Pending';
92101
93102 const statusBody = `# RFC approval status: ${status}\n\nCore team approvers: ${approvals.size ? [...approvals].join(', ') : 'None'}\nRejection from: ${rejections.size ? [...rejections].join(', ') : 'None'}\nAwaiting approval from: ${awaiting.length ? awaiting.join(', ') : 'None'}`;
103+ console.log('New status body to post:\n', statusBody);
94104
95105 // Try to locate the existing status comment (starts with our header)
96106 let statusComment = comments.find(c => c.body.startsWith('# RFC approval status:'));
0 commit comments