Skip to content

Commit e03e904

Browse files
authored
Update pull-requests.yml
1 parent 5686d44 commit e03e904

File tree

1 file changed

+1
-61
lines changed

1 file changed

+1
-61
lines changed

.github/workflows/pull-requests.yml

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: Pull Requests
22

3-
# Credit: https://github.com/github/docs/blob/main/.github/workflows/notify-when-maintainers-cannot-edit.yaml
4-
53
on:
64
pull_request_target:
75
types:
@@ -12,62 +10,4 @@ permissions:
1210

1311
jobs:
1412
uneditable:
15-
if: github.repository == 'laravel/framework'
16-
17-
runs-on: ubuntu-latest
18-
19-
steps:
20-
- uses: actions/github-script@v6
21-
with:
22-
script: |
23-
const query = `
24-
query($number: Int!) {
25-
repository(owner: "laravel", name: "framework") {
26-
pullRequest(number: $number) {
27-
headRepositoryOwner {
28-
login
29-
}
30-
maintainerCanModify
31-
}
32-
}
33-
}
34-
`;
35-
36-
const pullNumber = context.issue.number;
37-
const variables = { number: pullNumber };
38-
39-
try {
40-
console.log(`Check laravel/framework#${pullNumber} for maintainer edit access ...`);
41-
42-
const result = await github.graphql(query, variables);
43-
44-
console.log(JSON.stringify(result, null, 2));
45-
46-
const pullRequest = result.repository.pullRequest;
47-
48-
if (pullRequest.headRepositoryOwner.login === 'laravel') {
49-
console.log('PR owned by laravel');
50-
51-
return;
52-
}
53-
54-
if (! pullRequest.maintainerCanModify) {
55-
console.log('PR not owned by Laravel and does not have maintainer edits enabled');
56-
57-
await github.rest.issues.createComment({
58-
issue_number: pullNumber,
59-
owner: 'laravel',
60-
repo: 'framework',
61-
body: "Thanks for submitting a PR!\n\nIn order to review and merge PRs most efficiently, we require that all PRs grant maintainer edit access before we review them. For information on how to do this, [see the relevant GitHub documentation](https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork). Additionally, GitHub doesn't allow maintainer permissions from organization accounts. Please resubmit this PR with maintainer permissions enabled."
62-
});
63-
64-
await github.rest.pulls.update({
65-
pull_number: pullNumber,
66-
owner: 'laravel',
67-
repo: 'framework',
68-
state: 'closed'
69-
});
70-
}
71-
} catch(e) {
72-
console.log(e);
73-
}
13+
uses: laravel/.github/.github/workflows/pull-requests.yml@main

0 commit comments

Comments
 (0)