Skip to content

Commit 6fc0dfc

Browse files
committed
created org repo
0 parents  commit 6fc0dfc

10 files changed

Lines changed: 419 additions & 0 deletions
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: fix code styling
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
php:
7+
default: "8.2"
8+
type: string
9+
message:
10+
default: Fix code styling
11+
type: string
12+
fix:
13+
default: true
14+
type: boolean
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ inputs.php }}
28+
tools: composer:v2, laravel/pint
29+
extensions: json, dom, curl, libxml, mbstring
30+
coverage: none
31+
32+
- name: Run Pint
33+
run: pint
34+
35+
- name: Commit linted files
36+
if: ${{ inputs.fix }}
37+
uses: stefanzweifel/git-auto-commit-action@v7
38+
with:
39+
commit_message: ${{ inputs.message }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: compile assets
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node:
7+
default: "lts/*"
8+
type: string
9+
cmd:
10+
default: "production"
11+
type: string
12+
build_path:
13+
default: "public/"
14+
type: string
15+
16+
jobs:
17+
compile:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ inputs.node }}
27+
28+
- name: Install NPM dependencies
29+
run: npm ci
30+
31+
- name: Compile assets
32+
run: npm run ${{ inputs.cmd }}
33+
34+
- name: Commit compiled files
35+
uses: stefanzweifel/git-auto-commit-action@v7
36+
with:
37+
commit_message: Compile Assets
38+
file_pattern: ${{ inputs.build_path }}

.github/workflows/issues.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: issues
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
help-wanted:
8+
if: github.event.label.name == 'help wanted'
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Add comment
14+
uses: peter-evans/create-or-update-comment@v4
15+
with:
16+
issue-number: ${{ github.event.issue.number }}
17+
body: |
18+
Thank you for reporting this issue!
19+
20+
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
21+
22+
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
23+
24+
Thank you!
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: normalize composer.json files
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
php:
7+
default: "8.4"
8+
type: string
9+
message:
10+
default: Normalize composer.json files
11+
type: string
12+
fix:
13+
default: true
14+
type: boolean
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ inputs.php }}
28+
tools: composer:v2, composer-normalize
29+
extensions: json, dom, curl, libxml, mbstring
30+
coverage: none
31+
32+
- name: Normalize every composer.json file
33+
run: find . -path "*/vendor" -prune -o -name "composer.json" -print -exec composer normalize {} \;
34+
35+
- name: Commit linted files
36+
if: ${{ inputs.fix }}
37+
uses: stefanzweifel/git-auto-commit-action@v7
38+
with:
39+
commit_message: ${{ inputs.message }}
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: pull requests
2+
3+
# Credit: https://github.com/github/docs/blob/main/.github/workflows/notify-when-maintainers-cannot-edit.yaml
4+
5+
on:
6+
workflow_call:
7+
8+
jobs:
9+
draft:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/github-script@v7
14+
with:
15+
script: |
16+
const repo = context.repo.repo;
17+
18+
const query = `
19+
query($number: Int!) {
20+
repository(owner: "laravel", name: "${repo}") {
21+
pullRequest(number: $number) {
22+
headRepositoryOwner {
23+
login
24+
}
25+
isDraft
26+
state
27+
}
28+
}
29+
}
30+
`;
31+
32+
const pullNumber = context.issue.number;
33+
const variables = { number: pullNumber };
34+
35+
try {
36+
console.log(`Determine if pull request is submitted as draft ...`);
37+
38+
const result = await github.graphql(query, variables);
39+
40+
console.log(JSON.stringify(result, null, 2));
41+
42+
const pullRequest = result.repository.pullRequest;
43+
44+
if (pullRequest.headRepositoryOwner.login === 'laravel') {
45+
console.log('PR owned by laravel');
46+
47+
return;
48+
}
49+
50+
if (pullRequest.state !== 'OPEN') {
51+
console.log('PR has already been closed or merged.');
52+
53+
return;
54+
}
55+
56+
if (pullRequest.isDraft) {
57+
console.log('PR not owned by Laravel and is submitted as a draft.');
58+
59+
await github.rest.issues.createComment({
60+
issue_number: pullNumber,
61+
owner: 'laravel',
62+
repo: context.repo.repo,
63+
body: "Thanks for submitting a PR!\n\nNote that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.\n\nPull requests that are abandoned in draft may be closed due to inactivity."
64+
});
65+
}
66+
} catch(e) {
67+
console.log(e);
68+
}
69+
70+
uneditable:
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- uses: actions/github-script@v7
75+
with:
76+
script: |
77+
const repo = context.repo.repo;
78+
79+
const query = `
80+
query($number: Int!) {
81+
repository(owner: "laravel", name: "${repo}") {
82+
pullRequest(number: $number) {
83+
headRepositoryOwner {
84+
login
85+
}
86+
maintainerCanModify
87+
state
88+
}
89+
}
90+
}
91+
`;
92+
93+
const pullNumber = context.issue.number;
94+
const variables = { number: pullNumber };
95+
96+
try {
97+
console.log(`Check for maintainer edit access ...`);
98+
99+
const result = await github.graphql(query, variables);
100+
101+
console.log(JSON.stringify(result, null, 2));
102+
103+
const pullRequest = result.repository.pullRequest;
104+
105+
if (pullRequest.headRepositoryOwner.login === 'laravel') {
106+
console.log('PR owned by laravel');
107+
108+
return;
109+
}
110+
111+
if (pullRequest.state !== 'OPEN') {
112+
console.log('PR has already been closed or merged');
113+
114+
return;
115+
}
116+
117+
if (! pullRequest.maintainerCanModify) {
118+
console.log('PR not owned by Laravel and does not have maintainer edits enabled');
119+
120+
await github.rest.issues.createComment({
121+
issue_number: pullNumber,
122+
owner: 'laravel',
123+
repo: context.repo.repo,
124+
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 from a personal GitHub account with maintainer permissions enabled."
125+
});
126+
127+
await github.rest.pulls.update({
128+
pull_number: pullNumber,
129+
owner: 'laravel',
130+
repo: context.repo.repo,
131+
state: 'closed'
132+
});
133+
}
134+
} catch(e) {
135+
console.log(e);
136+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: static analysis
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
tests:
8+
runs-on: ubuntu-latest
9+
10+
name: Static Analysis
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: 8.2
20+
extensions: swoole, relay
21+
tools: composer:v2
22+
coverage: none
23+
24+
- name: Install dependencies
25+
uses: nick-fields/retry@v3
26+
with:
27+
timeout_minutes: 5
28+
max_attempts: 5
29+
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
30+
31+
- name: Execute type checking
32+
run: vendor/bin/phpstan --verbose

0 commit comments

Comments
 (0)