Skip to content

Commit 0be2e32

Browse files
kbondnicolas-grekas
authored andcommitted
Auto-close PRs on subtree-splits
1 parent 8d8bf63 commit 0be2e32

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/Tests export-ignore
22
/phpunit.xml.dist export-ignore
3+
/.git* export-ignore

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
4+
Please submit your PR here instead:
5+
https://github.com/twigphp/Twig
6+
7+
This repository is what we call a "subtree split": a read-only subset of that main repository.
8+
We're looking forward to your PR there!
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Check subtree split
2+
on:
3+
pull_request_target:
4+
jobs:
5+
close-pull-request:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Close pull request
9+
uses: actions/github-script@v6
10+
with:
11+
script: |
12+
if (context.repo.owner === "twigphp") {
13+
github.rest.issues.createComment({
14+
owner: "twigphp",
15+
repo: context.repo.repo,
16+
issue_number: context.issue.number,
17+
body: `
18+
Thanks for your Pull Request! We love contributions.
19+
20+
However, you should instead open your PR on the main repository:
21+
https://github.com/twigphp/Twig
22+
23+
This repository is what we call a "subtree split": a read-only subset of that main repository.
24+
We're looking forward to your PR there!
25+
`
26+
});
27+
github.rest.pulls.update({
28+
owner: "twigphp",
29+
repo: context.repo.repo,
30+
pull_number: context.issue.number,
31+
state: "closed"
32+
});
33+
}

0 commit comments

Comments
 (0)