indexer: index more details about blocks and transactions #401
Workflow file for this run
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
name: API Swagger Docs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- 'api/**/*' | |
jobs: | |
api-swagger: | |
name: Generate vocdoni-api.yaml | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
cache: false | |
- name: Install swag | |
run: | | |
curl -L https://github.com/swaggo/swag/releases/download/v1.16.3/swag_1.16.3_Linux_amd64.tar.gz | tar -xzf - | |
- name: Run swag | |
run: ./swag init --parseDependency --parseDepth 1 --parseInternal --md api/docs/descriptions --overridesFile api/docs/.swaggo -g api.go -d api/,api/docs/models/ -o api/docs --ot yaml | |
- name: Install api-spec-converter | |
run: npm install -g api-spec-converter | |
- name: Convert the Swagger file to OAS3 format | |
run: api-spec-converter --from=swagger_2 --to=openapi_3 --syntax=yaml api/docs/swagger.yaml > api/docs/oas3.yaml | |
- name: yq - portable yaml processor | |
uses: mikefarah/[email protected] | |
with: | |
cmd: | | |
yq '.components.schemas."api.GenericTransactionWithInfo".properties.tx = load("api/docs/models/transactions.yaml").target' \ | |
api/docs/oas3.yaml > api/docs/vocdoni-api.yaml | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vocdoni-api.yaml | |
path: api/docs/vocdoni-api.yaml | |
developer-portal-pr: | |
name: Open PR to developer-portal repo | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'pull_request' }} | |
needs: api-swagger | |
steps: | |
- name: Checkout developer-portal repo | |
uses: actions/checkout@v4 | |
with: | |
repository: vocdoni/developer-portal | |
ref: main | |
- name: Remove old yaml | |
run: rm swaggers/vocdoni-api.yaml | |
- name: Pull new yaml | |
uses: actions/download-artifact@v4 | |
with: | |
name: vocdoni-api.yaml | |
path: swaggers | |
- uses: benjlevesque/[email protected] # sets env.SHA to the first 7 chars of github.sha | |
- name: Create PR to developer-portal repo | |
id: cpr | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.VOCDONIBOT_PAT }} | |
commit-message: "Update vocdoni-api docs by commit ${{ env.SHA }}" | |
committer: "Arabot-1 <[email protected]>" | |
base: main | |
branch: update-api-docs | |
#branch-suffix: short-commit-hash ## creates temp update-sdk-docs-xyz branches | |
delete-branch: true ## true: delete branch after merging | |
title: Update docs with vocdoni-api repo changes | |
body: | | |
* This is an automated pull request to upload the updated vocdoni-api documentation. | |
* GitHub Action Run: [${{ github.run_id }}](https://github.com/vocdoni/vocdoni-node/actions/runs/${{ github.run_id }}) | |
labels: | | |
automated pr | |
reviewers: ${{ github.actor }} | |
team-reviewers: SdkDocsReviewer | |
- name: "Check PR: ${{ steps.cpr.outputs.pull-request-url }}" | |
if: ${{ steps.cpr.outputs.pull-request-number }} | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |