CI: check maintainer team membership for labels

This commit is contained in:
Shadow
2026-02-09 18:59:23 -06:00
parent 8c73dbe705
commit 70f9edeec7

View File

@@ -30,14 +30,26 @@ jobs:
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const association = context.payload.pull_request?.author_association;
if (!association) {
const login = context.payload.pull_request?.user?.login;
if (!login) {
return;
}
if (![
"MEMBER",
"OWNER",
].includes(association)) {
let isMaintainer = false;
try {
const membership = await github.rest.teams.getMembershipForUserInOrg({
org: context.repo.owner,
team_slug: "maintainer",
username: login,
});
isMaintainer = membership?.data?.state === "active";
} catch (error) {
if (error?.status !== 404) {
throw error;
}
}
if (!isMaintainer) {
return;
}
@@ -62,14 +74,26 @@ jobs:
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const association = context.payload.issue?.author_association;
if (!association) {
const login = context.payload.issue?.user?.login;
if (!login) {
return;
}
if (![
"MEMBER",
"OWNER",
].includes(association)) {
let isMaintainer = false;
try {
const membership = await github.rest.teams.getMembershipForUserInOrg({
org: context.repo.owner,
team_slug: "maintainer",
username: login,
});
isMaintainer = membership?.data?.state === "active";
} catch (error) {
if (error?.status !== 404) {
throw error;
}
}
if (!isMaintainer) {
return;
}