@@ -9933,12 +9933,8 @@ module.exports = class Helpers {
99339933 /**
99349934 * Check if a GitHub user is a core team member
99359935 *
9936- * Note: We previously tried using team membership checks, but the GITHUB_TOKEN
9937- * used in Actions cannot access team membership data, even for "visible"
9938- * (non-secret) teams. This is a GitHub limitation.
9939- *
9940- * Instead, we identify core team members by:
9941- * 1. Being a member of the TryGhost organization AND
9936+ * We identify core team members by:
9937+ * 1. Being a member of the TryGhost organization (checked via author_association)
99429938 * 2. Having write or admin access to the Admin repository
99439939 *
99449940 * This approach correctly distinguishes between:
@@ -9947,23 +9943,18 @@ module.exports = class Helpers {
99479943 * - Community (not org member)
99489944 *
99499945 * @param {string} username
9946+ * @param {string} authorAssociation The PR author's association with the repository
99509947 * @returns {Promise<boolean>}
99519948 */
9952- async isGhostFoundationMember(username) {
9949+ async isGhostFoundationMember(username, authorAssociation ) {
99539950 try {
9954- // First check org membership
9955- try {
9956- await this.client.rest.orgs.checkMembershipForUser({
9957- org: 'TryGhost',
9958- username: username
9959- });
9960- core.info(`User ${username} is a member of TryGhost org`);
9961- } catch (err) {
9962- if (err.status === 404) {
9963- core.info(`User ${username} is not a member of TryGhost org`);
9964- return false;
9965- }
9966- throw err;
9951+ // First check if they're an org member using author_association
9952+ const isOrgMember = ['OWNER', 'MEMBER'].includes(authorAssociation);
9953+ core.info(`User ${username} has ${authorAssociation} association with the repository`);
9954+
9955+ if (!isOrgMember) {
9956+ core.info('User is not an organization member');
9957+ return false;
99679958 }
99689959
99699960 // If they're an org member, check Admin repo permissions
@@ -10261,6 +10252,7 @@ async function main() {
1026110252 if (payload.action === 'opened') {
1026210253 const pullRequest = payload.pull_request;
1026310254 const author = pullRequest.user.login;
10255+ core.info(`PR opened #${pullRequest.number} by ${author} (${pullRequest.state}, ${pullRequest.author_association})`);
1026410256
1026510257 // Check if this is a dependency bot PR (e.g., Renovate, Dependabot)
1026610258 const isDependencyBot = (pullRequest.user.type === 'Bot' || author.includes('[bot]') || author === 'renovate-bot') &&
@@ -10274,7 +10266,7 @@ async function main() {
1027410266 core.info(`Skipping labeling for bot PR #${pullRequest.number} by ${author}`);
1027510267 } else {
1027610268 // Check if the PR author is a member of the Ghost Foundation team
10277- const isGhostMember = await helpers.isGhostFoundationMember(author);
10269+ const isGhostMember = await helpers.isGhostFoundationMember(author, pullRequest.author_association );
1027810270
1027910271 // Add appropriate label based on membership
1028010272 if (isGhostMember) {
0 commit comments