Skip to content

Commit

Permalink
try generate security scheme using go
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJenicek committed Oct 22, 2024
1 parent 03b169f commit 5420d78
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
33 changes: 32 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
paths:
- "**/examples.json"
- "**/*.gen.yaml"
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -29,4 +30,34 @@ jobs:
branch: ${{ github.head_ref }}
## since openapi docs are generated and PR is automatically created there is no need to try create new one
pr_create: false
overwrite: true
overwrite: true

securityScheme:
runs-on: ubuntu-latest
name: Add security schemes
steps:
- name: git-checkout
uses: actions/checkout@v4
with:
lfs: true

- name: setup-go
uses: actions/setup-go@v5
with:
go-version: "1.22.5"

- name: Update openapi docs
run: |
# Read the changed files from the previous step
go get github.com/mikefarah/yq/v4
go run github.com/mikefarah/yq/v4 -e -i '.security=[{"ApiKeyAuth":[]}]' docs/pages/api/metadata/metadata.gen.yaml
- name: Push changes
uses: 0xsequence/actions/git-commit@master
env:
API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN_GIT_COMMIT }}
with:
src: "docs/pages/api/**/*.gen.yaml"
branch: ${{ github.head_ref }}
## since openapi docs are generated and PR is automatically created there is no need to try create new one
pr_create: false
35 changes: 35 additions & 0 deletions .github/workflows/scheme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Scheme
on:
pull_request:

jobs:
securityScheme:
runs-on: ubuntu-latest
name: Add security schemes
steps:
- name: git-checkout
uses: actions/checkout@v4
with:
lfs: true

- name: setup-go
uses: actions/setup-go@v5
with:
go-version: "1.22.5"

- name: Update openapi docs
run: |
# Read the changed files from the previous step
go mod init github.com/0xsequence/docs
go install github.com/mikefarah/yq/v4@latest
go run github.com/mikefarah/yq/v4 -e -i '.security=[{"ApiKeyAuth":[]}]' docs/pages/api/metadata/metadata.gen.yaml
- name: Push changes
uses: 0xsequence/actions/git-commit@master
env:
API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN_GIT_COMMIT }}
with:
src: "docs/pages/api/**/*.gen.yaml"
branch: ${{ github.head_ref }}
## since openapi docs are generated and PR is automatically created there is no need to try create new one
pr_create: false

0 comments on commit 5420d78

Please sign in to comment.