Skip to content

Commit 8cab189

Browse files
retrevorRon Trevormahiariranigithub-actions[bot]
authored
feat: Create API for new storage folder (#168)
* First version, wip * feat(#1989): create api for new Swarm storage folder. - add: conforms to OCS OpenAPI standard - add: add composer packages for OCS extractor * feat(#1989): create api for new Swarm storage folder. - reverse previous commit * feat(#1989): create api for new Swarm storage folder. - reverse previous commit * feat(#1989): create api for new Swarm storage folder. - reverse previous commit * chore: precommit setup and lint fixes * feat(#1989): add ConfigurationController for storage creation - add: new ConfigurationController with create endpoint with redirect to NC URL. - add: corresponding route in routes.php * chore(#1989): Run php-cs-fixer on committed files * refactor: use const for the key on key * chore: code style * feat: reuse URL validation * chore: code style * feat: error and creation handling * feat: lint-stage and precommit rules * fix: lint ci * chore: apply automated formatting --------- Co-authored-by: Ron Trevor <ecoron@proton.me> Co-authored-by: Mahyar Iranibazaz <mahiarirani@pm.me> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 960cf55 commit 8cab189

14 files changed

Lines changed: 4489 additions & 121 deletions

File tree

.github/workflows/lint.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Lint
22

3+
permissions:
4+
contents: write
5+
36
on:
47
pull_request:
58
branches:
@@ -10,16 +13,16 @@ on:
1013
- reopened
1114

1215
jobs:
13-
backend-lint:
14-
name: Backend Lint
16+
format-sync:
17+
name: Format Sync
1518
runs-on: ubuntu-latest
1619

17-
strategy:
18-
fail-fast: true
19-
2020
steps:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.head_ref }}
25+
fetch-depth: 0
2326

2427
- name: Setup PHP
2528
uses: shivammathur/setup-php@v2
@@ -28,18 +31,48 @@ jobs:
2831
tools: composer
2932

3033
- name: Install php-cs-fixer
31-
run: composer require --dev friendsofphp/php-cs-fixer
34+
run: composer require --dev friendsofphp/php-cs-fixer nextcloud/coding-standard --no-interaction --no-progress --no-scripts
35+
36+
- name: Apply php-cs-fixer
37+
run: vendor/bin/php-cs-fixer fix
38+
39+
- name: Setup pnpm
40+
uses: pnpm/action-setup@v4
41+
with:
42+
version: 10.28.2
43+
run_install: false
44+
45+
- name: Setup Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: "24"
49+
cache: "pnpm"
3250

33-
- name: Run php-cs-fixer
34-
run: vendor/bin/php-cs-fixer fix --dry-run --diff
51+
- name: Install JS dependencies
52+
run: pnpm install --frozen-lockfile
53+
54+
- name: Apply Biome format
55+
run: pnpm run format:fix
56+
57+
- name: Commit format changes
58+
uses: stefanzweifel/git-auto-commit-action@v5
59+
with:
60+
commit_message: "chore: apply automated formatting"
61+
commit_user_name: "github-actions[bot]"
62+
commit_user_email: "github-actions[bot]@users.noreply.github.com"
63+
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
3564

3665
frontend-lint:
3766
name: Frontend Lint
3867
runs-on: ubuntu-latest
68+
needs: format-sync
3969

4070
steps:
4171
- name: Checkout code
4272
uses: actions/checkout@v4
73+
with:
74+
ref: ${{ github.head_ref }}
75+
fetch-depth: 0
4376

4477
- name: Setup pnpm
4578
uses: pnpm/action-setup@v4
@@ -59,8 +92,5 @@ jobs:
5992
- name: Run Biome lint
6093
run: pnpm run lint
6194

62-
- name: Run Biome format check
63-
run: pnpm run format
64-
6595
- name: Run TypeScript type check
6696
run: pnpm run typecheck

appinfo/routes.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,17 @@
3333
'url' => '/feedback/submit',
3434
'verb' => 'POST',
3535
],
36+
[
37+
'name' => 'Configuration#create',
38+
'url' => 'configure/create',
39+
'verb' => 'GET',
40+
],
41+
],
42+
'ocs' => [
43+
[
44+
'name' => 'Storage#create',
45+
'url' => '/api/v1/storages',
46+
'verb' => 'POST',
47+
],
3648
],
3749
];

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
}
99
},
1010
"require": {
11-
"ext-curl": "*"
11+
"ext-curl": "*",
12+
"ext-simplexml": "*"
1213
},
1314
"require-dev": {
14-
"nextcloud/coding-standard": "^1.3.2",
15+
"nextcloud/coding-standard": "^1.4",
1516
"ext-fileinfo": "*",
1617
"friendsofphp/php-cs-fixer": "*",
17-
"bamarni/composer-bin-plugin": "^1.8"
18+
"bamarni/composer-bin-plugin": "^1.8",
19+
"vimeo/psalm": "*"
1820
},
1921
"scripts": {
2022
"cs:check": "./vendor/php-cs-fixer/shim/php-cs-fixer.phar fix --dry-run --diff",

0 commit comments

Comments
 (0)