Skip to content

Commit f23e5d1

Browse files
committed
minor #1751 Auto-close PRs on subtree-splits (kbond)
This PR was merged into the 2.x branch. Discussion ---------- Auto-close PRs on subtree-splits | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Issues | n/a | License | MIT Same as symfony/symfony#54653 Commits ------- 63ee860 Auto-close PRs on subtree-splits
2 parents 39b3be1 + 63ee860 commit f23e5d1

File tree

56 files changed

+775
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+775
-36
lines changed

.github/sync-packages.php

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
if ('cli' !== PHP_SAPI) {
4+
echo "This script can only be run from the command line.\n";
5+
exit(1);
6+
}
7+
8+
$mainRepo = 'https://github.com/symfony/ux';
9+
exec('find src/ -name composer.json', $packages);
10+
11+
foreach ($packages as $package) {
12+
$package = dirname($package);
13+
$c = file_get_contents($package.'/.gitattributes');
14+
$c = preg_replace('{^/\.git.*+\n}m', '', $c);
15+
$c .= "/.git* export-ignore\n";
16+
file_put_contents($package.'/.gitattributes', $c);
17+
18+
19+
@mkdir($package.'/.github');
20+
file_put_contents($package.'/.github/PULL_REQUEST_TEMPLATE.md', <<<EOTXT
21+
Please do not submit any Pull Requests here. They will be closed.
22+
---
23+
Please submit your PR here instead:
24+
{$mainRepo}
25+
This repository is what we call a "subtree split": a read-only subset of that main repository.
26+
We're looking forward to your PR there!
27+
EOTXT
28+
);
29+
30+
@mkdir($package.'/.github/workflows');
31+
file_put_contents($package.'/.github/workflows/check-subtree-split.yml', <<<EOTXT
32+
name: Check subtree split
33+
on:
34+
pull_request_target:
35+
jobs:
36+
close-pull-request:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Close pull request
40+
uses: actions/github-script@v6
41+
with:
42+
script: |
43+
if (context.repo.owner === "symfony") {
44+
github.rest.issues.createComment({
45+
owner: "symfony",
46+
repo: context.repo.repo,
47+
issue_number: context.issue.number,
48+
body: `
49+
Thanks for your Pull Request! We love contributions.
50+
However, you should instead open your PR on the main repository:
51+
{$mainRepo}
52+
This repository is what we call a "subtree split": a read-only subset of that main repository.
53+
We're looking forward to your PR there!
54+
`
55+
});
56+
github.rest.pulls.update({
57+
owner: "symfony",
58+
repo: context.repo.repo,
59+
pull_number: context.issue.number,
60+
state: "closed"
61+
});
62+
}
63+
EOTXT
64+
);
65+
}

.github/workflows/package-tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Verify Packages
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- src/**
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
verify:
13+
name: Verify Packages
14+
runs-on: Ubuntu-20.04
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Fetch branch from where the PR started
20+
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
21+
22+
- name: Verify subtree-splits are auto-closed
23+
run: |
24+
php .github/sync-packages.php
25+
git add src/
26+
git diff --staged --exit-code || (echo '::error::Please run "php .github/sync-packages.php".' && exit 1)

src/Autocomplete/.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/.gitattributes export-ignore
2-
/.gitignore export-ignore
31
/.symfony.bundle.yaml export-ignore
42
/assets/src export-ignore
53
/assets/test export-ignore
64
/phpunit.xml.dist export-ignore
75
/tests export-ignore
6+
/.git* export-ignore
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
Please submit your PR here instead:
4+
https://github.com/symfony/ux
5+
This repository is what we call a "subtree split": a read-only subset of that main repository.
6+
We're looking forward to your PR there!
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 === "symfony") {
13+
github.rest.issues.createComment({
14+
owner: "symfony",
15+
repo: context.repo.repo,
16+
issue_number: context.issue.number,
17+
body: `
18+
Thanks for your Pull Request! We love contributions.
19+
However, you should instead open your PR on the main repository:
20+
https://github.com/symfony/ux
21+
This repository is what we call a "subtree split": a read-only subset of that main repository.
22+
We're looking forward to your PR there!
23+
`
24+
});
25+
github.rest.pulls.update({
26+
owner: "symfony",
27+
repo: context.repo.repo,
28+
pull_number: context.issue.number,
29+
state: "closed"
30+
});
31+
}

src/Chartjs/.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/.gitattributes export-ignore
2-
/.gitignore export-ignore
31
/.symfony.bundle.yaml export-ignore
42
/assets/src export-ignore
53
/assets/test export-ignore
64
/assets/vitest.config.js export-ignore
75
/phpunit.xml.dist export-ignore
86
/tests export-ignore
7+
/.git* export-ignore
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
Please submit your PR here instead:
4+
https://github.com/symfony/ux
5+
This repository is what we call a "subtree split": a read-only subset of that main repository.
6+
We're looking forward to your PR there!
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 === "symfony") {
13+
github.rest.issues.createComment({
14+
owner: "symfony",
15+
repo: context.repo.repo,
16+
issue_number: context.issue.number,
17+
body: `
18+
Thanks for your Pull Request! We love contributions.
19+
However, you should instead open your PR on the main repository:
20+
https://github.com/symfony/ux
21+
This repository is what we call a "subtree split": a read-only subset of that main repository.
22+
We're looking forward to your PR there!
23+
`
24+
});
25+
github.rest.pulls.update({
26+
owner: "symfony",
27+
repo: context.repo.repo,
28+
pull_number: context.issue.number,
29+
state: "closed"
30+
});
31+
}

src/Cropperjs/.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/.gitattributes export-ignore
2-
/.gitignore export-ignore
31
/.symfony.bundle.yaml export-ignore
42
/assets/src export-ignore
53
/assets/test export-ignore
64
/phpunit.xml.dist export-ignore
75
/tests export-ignore
6+
/.git* export-ignore
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
Please submit your PR here instead:
4+
https://github.com/symfony/ux
5+
This repository is what we call a "subtree split": a read-only subset of that main repository.
6+
We're looking forward to your PR there!
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 === "symfony") {
13+
github.rest.issues.createComment({
14+
owner: "symfony",
15+
repo: context.repo.repo,
16+
issue_number: context.issue.number,
17+
body: `
18+
Thanks for your Pull Request! We love contributions.
19+
However, you should instead open your PR on the main repository:
20+
https://github.com/symfony/ux
21+
This repository is what we call a "subtree split": a read-only subset of that main repository.
22+
We're looking forward to your PR there!
23+
`
24+
});
25+
github.rest.pulls.update({
26+
owner: "symfony",
27+
repo: context.repo.repo,
28+
pull_number: context.issue.number,
29+
state: "closed"
30+
});
31+
}

src/Dropzone/.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/.gitattributes export-ignore
2-
/.gitignore export-ignore
31
/.symfony.bundle.yaml export-ignore
42
/assets/src export-ignore
53
/assets/test export-ignore
64
/phpunit.xml.dist export-ignore
75
/tests export-ignore
6+
/.git* export-ignore
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
Please submit your PR here instead:
4+
https://github.com/symfony/ux
5+
This repository is what we call a "subtree split": a read-only subset of that main repository.
6+
We're looking forward to your PR there!
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 === "symfony") {
13+
github.rest.issues.createComment({
14+
owner: "symfony",
15+
repo: context.repo.repo,
16+
issue_number: context.issue.number,
17+
body: `
18+
Thanks for your Pull Request! We love contributions.
19+
However, you should instead open your PR on the main repository:
20+
https://github.com/symfony/ux
21+
This repository is what we call a "subtree split": a read-only subset of that main repository.
22+
We're looking forward to your PR there!
23+
`
24+
});
25+
github.rest.pulls.update({
26+
owner: "symfony",
27+
repo: context.repo.repo,
28+
pull_number: context.issue.number,
29+
state: "closed"
30+
});
31+
}

src/Icons/.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/.gitattributes export-ignore
2-
/.gitignore export-ignore
31
/.symfony.bundle.yaml export-ignore
42
/phpunit.xml.dist export-ignore
53
/tests export-ignore
4+
/.git* export-ignore
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
Please submit your PR here instead:
4+
https://github.com/symfony/ux
5+
This repository is what we call a "subtree split": a read-only subset of that main repository.
6+
We're looking forward to your PR there!
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 === "symfony") {
13+
github.rest.issues.createComment({
14+
owner: "symfony",
15+
repo: context.repo.repo,
16+
issue_number: context.issue.number,
17+
body: `
18+
Thanks for your Pull Request! We love contributions.
19+
However, you should instead open your PR on the main repository:
20+
https://github.com/symfony/ux
21+
This repository is what we call a "subtree split": a read-only subset of that main repository.
22+
We're looking forward to your PR there!
23+
`
24+
});
25+
github.rest.pulls.update({
26+
owner: "symfony",
27+
repo: context.repo.repo,
28+
pull_number: context.issue.number,
29+
state: "closed"
30+
});
31+
}

src/LazyImage/.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/.gitattributes export-ignore
2-
/.gitignore export-ignore
31
/.symfony.bundle.yaml export-ignore
42
/assets/src export-ignore
53
/assets/test export-ignore
64
/phpunit.xml.dist export-ignore
75
/tests export-ignore
6+
/.git* export-ignore
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
Please submit your PR here instead:
4+
https://github.com/symfony/ux
5+
This repository is what we call a "subtree split": a read-only subset of that main repository.
6+
We're looking forward to your PR there!
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 === "symfony") {
13+
github.rest.issues.createComment({
14+
owner: "symfony",
15+
repo: context.repo.repo,
16+
issue_number: context.issue.number,
17+
body: `
18+
Thanks for your Pull Request! We love contributions.
19+
However, you should instead open your PR on the main repository:
20+
https://github.com/symfony/ux
21+
This repository is what we call a "subtree split": a read-only subset of that main repository.
22+
We're looking forward to your PR there!
23+
`
24+
});
25+
github.rest.pulls.update({
26+
owner: "symfony",
27+
repo: context.repo.repo,
28+
pull_number: context.issue.number,
29+
state: "closed"
30+
});
31+
}

0 commit comments

Comments
 (0)