-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28ae3f1
commit b8ea810
Showing
16 changed files
with
186 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
on: | ||
schedule: | ||
- cron: '0 7 * * *' | ||
|
||
env: | ||
DOCS_REPOSITORY: cachethq/docs | ||
DOCS_BRANCH: main | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.3 | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | ||
|
||
- name: Install dependencies | ||
run: composer install | ||
|
||
- name: Install Scramble PRO | ||
run: | | ||
composer config repositories.scramble-pro '{"type": "composer", "url": "https://satis.dedoc.co"}' | ||
composer config http-basic.satis.dedoc.co ${{ secrets.SCRAMBLE_USERNAME }} ${{ secrets.SCRAMBLE_KEY }} | ||
composer require dedoc/scramble-pro:0.7.0-alpha.1 --dev | ||
- name: Checkout documentation repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.DOCS_REPOSITORY }} | ||
ref: ${{ env.DOCS_BRANCH }} | ||
path: 'docs-repository' | ||
|
||
- name: Build API docs | ||
run: php vendor/bin/testbench scramble:export --path=docs-repository/api-reference/openapi.json | ||
|
||
- name: Commit and push generated specification | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "Generated API specification from ${{ github.repository }}/${{ github.ref}}@${{ github.sha }}" | ||
repository: "docs-repository" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Cachet\Documentation; | ||
|
||
use Dedoc\Scramble\Extensions\OperationExtension; | ||
use Dedoc\Scramble\Support\Generator\Operation; | ||
use Dedoc\Scramble\Support\RouteInfo; | ||
use Illuminate\Support\Str; | ||
|
||
class AddAuthenticationToOperation extends OperationExtension | ||
{ | ||
public function handle(Operation $operation, RouteInfo $routeInfo) | ||
{ | ||
$hasAuthMiddleware = collect($routeInfo->route->gatherMiddleware())->contains(fn ($m) => Str::startsWith($m, 'auth:')); | ||
|
||
if (! $hasAuthMiddleware) { | ||
$operation->addSecurity([]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.