mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-02-03 21:03:09 +00:00
Compare commits
3 Commits
fix-extern
...
fix-extern
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5bd3dfed1 | ||
|
|
76334d1f67 | ||
|
|
44328beed4 |
28
.github/workflows/close-external-prs.yml
vendored
28
.github/workflows/close-external-prs.yml
vendored
@@ -4,26 +4,34 @@ on:
|
|||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened]
|
types: [opened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
issues: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-membership:
|
check-membership:
|
||||||
if: vars.DISABLE_EXTERNAL_PR_CHECK != 'true'
|
if: vars.DISABLE_EXTERNAL_PR_CHECK != 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check if author is org member
|
- name: Check if author has write access
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const org = 'anthropics';
|
|
||||||
const author = context.payload.pull_request.user.login;
|
const author = context.payload.pull_request.user.login;
|
||||||
|
|
||||||
try {
|
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
|
||||||
await github.rest.orgs.checkMembershipForUser({
|
owner: context.repo.owner,
|
||||||
org: org,
|
repo: context.repo.repo,
|
||||||
username: author
|
username: author
|
||||||
});
|
});
|
||||||
console.log(`${author} is an org member, allowing PR`);
|
|
||||||
} catch (e) {
|
if (['admin', 'write'].includes(data.permission)) {
|
||||||
if (e.status === 404) {
|
console.log(`${author} has ${data.permission} access, allowing PR`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`${author} has ${data.permission} access, closing PR`);
|
||||||
|
|
||||||
await github.rest.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
@@ -37,7 +45,3 @@ jobs:
|
|||||||
pull_number: context.payload.pull_request.number,
|
pull_number: context.payload.pull_request.number,
|
||||||
state: 'closed'
|
state: 'closed'
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`Closed PR from external contributor: ${author}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user