Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Commit 0d11459

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/plugin_search
2 parents 176c3bb + ef0d77d commit 0d11459

32 files changed

+2683
-274
lines changed

.github/workflows/codeql.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ jobs:
4343

4444
steps:
4545
- name: Checkout repository
46-
uses: actions/checkout@v4
46+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4747

4848
# Initializes the CodeQL tools for scanning.
49+
# These all use the @v3 tag instead of a commit hash because I can't make hashes work with the three-level path.
4950
- name: Initialize CodeQL
5051
uses: github/codeql-action/init@v3
5152
with:

.github/workflows/dependency-review.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
runs-on: ubuntu-24.04
1818
steps:
1919
- name: 'Checkout Repository'
20-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2121
- name: 'Dependency Review'
22-
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1
22+
uses: actions/dependency-review-action@595b5aeba73380359d98a5e087f648dbb0edce1b # v4.7.3
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Commit Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions: # added using https://github.com/step-security/secure-repo
10+
contents: read
11+
12+
jobs:
13+
php-static-analysis:
14+
runs-on: ubuntu-24.04
15+
16+
steps:
17+
- name: Harden the runner (Audit all outbound calls)
18+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
19+
with:
20+
egress-policy: audit
21+
22+
- name: Checkout
23+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2
27+
with:
28+
php-version: 8.4
29+
30+
- name: Get composer cache directory
31+
id: composer-cache
32+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
33+
34+
- name: Cache composer dependencies
35+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
36+
with:
37+
path: ${{ steps.composer-cache.outputs.dir }}
38+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
39+
restore-keys: ${{ runner.os }}-composer-
40+
41+
- name: Install dependencies
42+
run: composer install
43+
44+
- name: Run PHPStan
45+
run: vendor/bin/phpstan --memory-limit=1G analyse -v
46+
47+
- name: Run Psalm
48+
run: vendor/bin/psalm --memory-limit=2G
49+

.github/workflows/phpunit.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Commit Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions: # added using https://github.com/step-security/secure-repo
10+
contents: read
11+
12+
jobs:
13+
phpunit:
14+
runs-on: ubuntu-24.04
15+
16+
strategy:
17+
matrix:
18+
php-versions: [ '8.4' ]
19+
20+
services:
21+
postgres:
22+
image: postgres:latest
23+
env:
24+
POSTGRES_USER: postgres
25+
POSTGRES_PASSWORD: postgres
26+
POSTGRES_DB: aspirecloud_testing
27+
ports:
28+
- 5432/tcp
29+
options: --health-cmd pg_isready --health-interval 2s --health-timeout 2s --health-retries 10
30+
31+
steps:
32+
- name: Harden the runner (Audit all outbound calls)
33+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
34+
with:
35+
egress-policy: audit
36+
37+
- name: Checkout
38+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39+
40+
- name: Setup PHP
41+
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2
42+
with:
43+
php-version: ${{ matrix.php-versions }}
44+
extensions: mbstring, pgsql
45+
# not doing coverage in CI yet
46+
# coverage: xdebug
47+
48+
- name: Get composer cache directory
49+
id: composer-cache
50+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
51+
52+
- name: Cache composer dependencies
53+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
54+
with:
55+
path: ${{ steps.composer-cache.outputs.dir }}
56+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
57+
restore-keys: ${{ runner.os }}-composer-
58+
59+
- name: Install dependencies
60+
run: composer install
61+
62+
- name: Prepare tests
63+
run: |
64+
cp .env.example .env
65+
php artisan key:generate
66+
php artisan migrate
67+
env:
68+
CACHE_STORE: array
69+
DB_HOST: localhost
70+
DB_PORT: ${{ job.services.postgres.ports[5432] }}
71+
DB_USERNAME: postgres
72+
DB_PASSWORD: postgres
73+
DB_DATABASE: aspirecloud_testing
74+
75+
- name: Run Pest
76+
run: vendor/bin/pest --ci
77+
env:
78+
CACHE_STORE: array
79+
DB_HOST: localhost
80+
DB_PORT: ${{ job.services.postgres.ports[5432] }}
81+
DB_USERNAME: postgres
82+
DB_PASSWORD: postgres
83+
DB_DATABASE: aspirecloud_testing
84+

.github/workflows/run-checks.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/scorecards.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: "Checkout code"
42-
uses: actions/checkout@v4
42+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4343
with:
4444
persist-credentials: false
4545

@@ -66,14 +66,14 @@ jobs:
6666
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6767
# format to the repository Actions tab.
6868
- name: "Upload artifact"
69-
uses: actions/upload-artifact@v4
69+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
7070
with:
7171
name: SARIF file
7272
path: results.sarif
7373
retention-days: 5
7474

7575
# Upload the results to GitHub's code scanning dashboard.
7676
- name: "Upload to code-scanning"
77-
uses: github/codeql-action/upload-sarif@v3
77+
uses: github/codeql-action/upload-sarif@v3 # I can't make commit hashes work with these three-level paths...
7878
with:
7979
sarif_file: results.sarif
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\API\WpOrg\Export;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Services\Exports\ExportService;
7+
use App\Values\WpOrg\Export\ExportRequest;
8+
use Illuminate\Http\Request;
9+
use Illuminate\Support\Facades\Storage;
10+
use Symfony\Component\HttpFoundation\StreamedResponse;
11+
12+
class ExportController extends Controller
13+
{
14+
public function __construct(
15+
private readonly ExportService $exportService,
16+
) {}
17+
18+
public function __invoke(Request $request, string $type): StreamedResponse
19+
{
20+
$req = ExportRequest::from([
21+
...$request->all(),
22+
'type' => $type,
23+
]);
24+
25+
$path = $this->exportService->getExportedFilePath($req);
26+
return $this->streamFromS3($path);
27+
}
28+
29+
/**
30+
* Stream the exported data from S3.
31+
*
32+
* @param string $path
33+
* @return StreamedResponse
34+
*/
35+
private function streamFromS3(string $path): StreamedResponse
36+
{
37+
$response = new StreamedResponse(function () use ($path) {
38+
$stream = Storage::disk('s3')->readStream($path);
39+
if (!$stream) {
40+
throw new \RuntimeException("Failed to read stream from S3 for key: $path");
41+
}
42+
43+
while (!feof($stream)) {
44+
echo fgets($stream, 16384);
45+
}
46+
47+
\Safe\fclose($stream);
48+
});
49+
50+
$response->headers->set('Content-Type', 'application/x-ndjson');
51+
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($path) . '"');
52+
53+
return $response;
54+
}
55+
}

app/Models/User.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Laravel\Fortify\TwoFactorAuthenticatable;
1515
use Laravel\Jetstream\HasProfilePhoto;
1616
use Laravel\Sanctum\HasApiTokens;
17+
use Laravel\Sanctum\PersonalAccessToken;
1718
use Spatie\Permission\Traits\HasRoles;
1819

1920
/**
@@ -30,12 +31,13 @@
3031
*/
3132
class User extends Authenticatable
3233
{
34+
/** @use HasApiTokens<PersonalAccessToken> */
3335
use HasApiTokens;
34-
use HasRoles;
3536

3637
/** @use HasFactory<UserFactory> */
3738
use HasFactory;
3839

40+
use HasRoles;
3941
use HasProfilePhoto;
4042
use Notifiable;
4143
use TwoFactorAuthenticatable;

0 commit comments

Comments
 (0)