sync: 1011 plugins (+197) #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Close External PRs | |
| on: | |
| pull_request_target: | |
| types: [opened, reopened] | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| close: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const author = context.payload.pull_request.user.login; | |
| const { data } = await github.rest.repos.getCollaboratorPermissionLevel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| username: author, | |
| }); | |
| if (['admin', 'write'].includes(data.permission)) { | |
| console.log(`${author} has ${data.permission} access — allowing PR`); | |
| return; | |
| } | |
| console.log(`${author} has ${data.permission} access — closing PR`); | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| body: [ | |
| `Thanks for the PR! This repo is a **read-only mirror** — its contents are synced nightly from Anthropic's internal review pipeline, so direct pull requests are closed automatically.`, | |
| ``, | |
| `To submit a plugin to the community marketplace, use [clau.de/plugin-directory-submission](https://clau.de/plugin-directory-submission).`, | |
| ].join('\n'), | |
| }); | |
| await github.rest.pulls.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.pull_request.number, | |
| state: 'closed', | |
| }); |