Skip to content

Commit 0585be3

Browse files
authored
Update pull-requests.yml
1 parent 6410c2c commit 0585be3

File tree

1 file changed

+1
-52
lines changed

1 file changed

+1
-52
lines changed

.github/workflows/pull-requests.yml

Lines changed: 1 addition & 52 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,53 +10,4 @@ permissions:
1210

1311
jobs:
1412
uneditable:
15-
if: github.repository == 'laravel/framework'
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
19-
with:
20-
script: |
21-
const query = `
22-
query($number: Int!) {
23-
repository(owner: "laravel", name: "framework") {
24-
pullRequest(number: $number) {
25-
headRepositoryOwner {
26-
login
27-
}
28-
maintainerCanModify
29-
}
30-
}
31-
}
32-
`;
33-
34-
const pullNumber = context.issue.number;
35-
const variables = { number: pullNumber };
36-
37-
try {
38-
console.log(`Check laravel/framework#${pullNumber} for maintainer edit access ...`);
39-
40-
const result = await github.graphql(query, variables);
41-
42-
console.log(JSON.stringify(result, null, 2));
43-
44-
const pullRequest = result.repository.pullRequest;
45-
46-
if (pullRequest.headRepositoryOwner.login === 'laravel') {
47-
console.log('PR owned by laravel');
48-
49-
return;
50-
}
51-
52-
if (!pullRequest.maintainerCanModify) {
53-
console.log('PR not owned by Laravel and does not have maintainer edits enabled');
54-
55-
await github.issues.createComment({
56-
issue_number: pullNumber,
57-
owner: 'laravel',
58-
repo: 'framework',
59-
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)."
60-
});
61-
}
62-
} catch(e) {
63-
console.log(e);
64-
}
13+
uses: laravel/.github/.github/workflows/pull-requests.yml@main

0 commit comments

Comments
 (0)