Skip to content

Commit

Permalink
Add required_workflows/check-subtree-split.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jan 31, 2023
1 parent ca6c181 commit ed38632
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions required_workflows/check-subtree-split.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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") {
const monoRepo = /^polyfill-/.test(context.repo.repo) ? "polyfill" : (/^ux-/.test(context.repo.repo) ? "ux" : "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 a pull request on the main repository:
https://github.com/symfony/${monoRepo}
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 ed38632

Please sign in to comment.