Skip to content

Commit

Permalink
Auto-close PRs on subtree-splits
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond authored and nicolas-grekas committed Apr 19, 2024
1 parent bc45c39 commit 2a090dc
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.git* export-ignore
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Please do not submit any Pull Requests here. They will be closed.
---

Please submit your PR here instead:
https://github.com/symfony/polyfill

This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!
33 changes: 33 additions & 0 deletions .github/workflows/check-subtree-split.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check subtree split
on:
pull_request_target:
jobs:
close-pull-request:
runs-on: ubuntu-latest
steps:
- name: Close pull request
uses: actions/github-script@v6
with:
script: |
if (context.repo.owner === "symfony") {
github.rest.issues.createComment({
owner: "symfony",
repo: context.repo.repo,
issue_number: context.issue.number,
body: `
Thanks for your Pull Request! We love contributions.
However, you should instead open your PR on the main repository:
https://github.com/symfony/polyfill
This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!
`
});
github.rest.pulls.update({
owner: "symfony",
repo: context.repo.repo,
pull_number: context.issue.number,
state: "closed"
});
}

0 comments on commit 2a090dc

Please sign in to comment.