Files
claude-plugins-official/.github/workflows/close-external-prs.yml
2026-01-06 14:08:09 -08:00

43 lines
1.5 KiB
YAML

name: Close External PRs
on:
pull_request_target:
types: [opened]
jobs:
check-membership:
runs-on: ubuntu-latest
steps:
- name: Check if author is org member
uses: actions/github-script@v7
with:
script: |
const org = 'anthropics';
const author = context.payload.pull_request.user.login;
try {
await github.rest.orgs.checkMembershipForUser({
org: org,
username: author
});
console.log(`${author} is an org member, allowing PR`);
} catch (e) {
if (e.status === 404) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please see [our submission process](https://docs.google.com/forms/d/e/1FAIpQLSdeFthxvjOXUjxg1i3KrOOkEPDJtn71XC-KjmQlxNP63xYydg/viewform).`
});
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
state: 'closed'
});
console.log(`Closed PR from external contributor: ${author}`);
}
}