What Does the `close-external-prs.yml` Workflow Do in Anthropic's Claude Plugins Community?

The close-external-prs.yml workflow automatically closes pull requests from unauthorized external contributors to maintain the repository's read-only mirror status.

This GitHub Actions automation protects the anthropics/claude-plugins-community repository from unwanted direct contributions. Running on every pull_request_target event, the workflow distinguishes between internal automation and external contributors, ensuring only authorized users can modify the codebase while redirecting genuine contributors to the official submission portal.

Workflow Triggers and Permissions

The automation fires on pull_request_target events for opened and reopened actions. According to the workflow definition in .github/workflows/close-external-prs.yml, this trigger is essential because it grants the workflow write permissions on the base repository even when processing pull requests originating from forks.

The workflow explicitly declares the permissions it requires:

permissions:
  pull-requests: write
  issues: write

These permissions allow the automation to post explanatory comments and update pull request states without exposing repository secrets to potentially malicious fork-based code.

Exemption Logic for Trusted Sources

Before closing any pull request, the workflow implements a two-tier validation system to identify authorized contributors.

Exempting the Internal Automation Bot

The workflow first checks if the pull request author is github-actions[bot]. This specific account is used by the nightly bump-plugin-shas.yml automation to synchronize plugin references. If the author matches this bot, the workflow exits immediately without closing the PR.

The logic is implemented in .github/workflows/close-external-prs.yml at lines 20-32, ensuring that internal maintenance automation can operate uninterrupted.

Validating Repository Collaborator Status

For non-bot authors, the workflow queries the GitHub API to verify repository access levels:

const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
  owner: context.repo.owner,
  repo: context.repo.repo,
  username: author,
});

const canWrite = ['admin', 'write'].includes(data.permission);

As implemented in lines 34-43 of the source file, only users with admin or write permissions pass validation. Authors without these permission levels are considered external contributors.

Automated Closure and Contributor Guidance

When an external contributor fails both exemption checks, the workflow executes a two-step closure process defined in lines 45-63 of .github/workflows/close-external-prs.yml.

First, it posts a standardized comment explaining the repository's nature:

const commentBody = [
  `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');

Second, it updates the pull request state to closed:

await github.rest.pulls.update({
  owner: context.repo.owner,
  repo: context.repo.repo,
  pull_number: context.payload.pull_request.number,
  state: 'closed',
});

This combination ensures contributors understand why their PR was rejected and provides a clear path to legitimate submission through the official clau.de/plugin-directory-submission portal.

Architectural Purpose and Security Design

The workflow serves as a gatekeeper for a synchronized repository architecture where the GitHub repository functions as a downstream mirror rather than a source of truth.

Protecting the Nightly Synchronization Pipeline

The anthropics/claude-plugins-community repository receives its content via automated synchronization from Anthropic's internal review pipeline. Direct modifications through GitHub pull requests would be overwritten during the next nightly sync. By closing external PRs automatically, the workflow prevents contributors from wasting effort on changes that cannot persist.

Safe Execution via pull_request_target

Using pull_request_target rather than standard pull_request events allows the workflow to execute with write permissions against the base repository while processing code from forked repositories. This trigger runs in the context of the base repository's code, not the fork's code, preventing malicious pull requests from accessing secrets or modifying the workflow behavior.

Several files work in concert with close-external-prs.yml to maintain repository integrity:

  • .github/workflows/bump-plugin-shas.yml – The only automation exempted from closure, responsible for nightly plugin SHA updates
  • .github/owner-baseline.json – Contains baseline permission data for repository validation workflows
  • .github/actions/validate-plugins/ – Supporting actions that depend on the repository maintaining its read-only mirror status

Summary

  • The close-external-prs.yml workflow automatically rejects external pull requests to the anthropics/claude-plugins-community repository.
  • It triggers on pull_request_target events to safely handle forks with elevated permissions.
  • The workflow exempts github-actions[bot] (used for nightly SHA bumping) and repository collaborators with admin or write access.
  • Unauthorized PRs receive an explanatory comment directing authors to clau.de/plugin-directory-submission before being closed.
  • This automation protects the repository's read-only mirror status, ensuring content remains synchronized with Anthropic's internal pipeline.

Frequently Asked Questions

What is close-external-prs.yml?

close-external-prs.yml is a GitHub Actions workflow file located at .github/workflows/close-external-prs.yml in the anthropics/claude-plugins-community repository. It automatically closes pull requests submitted by users who lack administrative or write access to the repository, while exempting the internal github-actions[bot] used for maintenance tasks.

Why does the workflow use pull_request_target instead of pull_request?

The workflow uses pull_request_target because this trigger executes in the context of the base repository, granting the workflow write permissions to comment on and close pull requests even when they originate from forked repositories. The standard pull_request trigger runs in the fork's context and cannot safely modify PRs from untrusted sources without exposing repository secrets.

How can external contributors submit plugins if PRs are closed automatically?

External contributors must use the official submission portal at clau.de/plugin-directory-submission rather than GitHub pull requests. The workflow automatically posts this URL in closing comments to redirect contributors to the proper channel where Anthropic's internal review pipeline can process submissions.

Who can open pull requests without them being closed?

Only two categories of users can open pull requests that remain open: the github-actions[bot] account (which runs the nightly bump-plugin-shas.yml automation) and repository collaborators with admin or write permissions as verified by the repos.getCollaboratorPermissionLevel API call.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →