mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
CI: check maintainer team membership for labels
This commit is contained in:
48
.github/workflows/labeler.yml
vendored
48
.github/workflows/labeler.yml
vendored
@@ -30,14 +30,26 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github-token: ${{ steps.app-token.outputs.token }}
|
github-token: ${{ steps.app-token.outputs.token }}
|
||||||
script: |
|
script: |
|
||||||
const association = context.payload.pull_request?.author_association;
|
const login = context.payload.pull_request?.user?.login;
|
||||||
if (!association) {
|
if (!login) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (![
|
|
||||||
"MEMBER",
|
let isMaintainer = false;
|
||||||
"OWNER",
|
try {
|
||||||
].includes(association)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,14 +74,26 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github-token: ${{ steps.app-token.outputs.token }}
|
github-token: ${{ steps.app-token.outputs.token }}
|
||||||
script: |
|
script: |
|
||||||
const association = context.payload.issue?.author_association;
|
const login = context.payload.issue?.user?.login;
|
||||||
if (!association) {
|
if (!login) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (![
|
|
||||||
"MEMBER",
|
let isMaintainer = false;
|
||||||
"OWNER",
|
try {
|
||||||
].includes(association)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user