update to go 1.23.0 #482
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: benjlevesque/[email protected] # sets env.SHA to the first 7 chars of github.sha | |
- name: Checkout developer-portal repo | |
uses: actions/checkout@v4 | |
with: | |
repository: vocdoni/developer-portal | |
ref: main | |
path: developer-portal | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
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 > developer-portal/swaggers/vocdoni-api.yaml | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vocdoni-api.yaml | |
path: developer-portal/swaggers/vocdoni-api.yaml | |
- name: Check if there is a difference | |
uses: mathiasvr/[email protected] | |
id: diff | |
with: | |
run: git -C developer-portal diff --no-color swaggers/vocdoni-api.yaml | |
- name: Mark previous comment as outdated if no diff | |
if: ${{ github.event_name == 'pull_request' && steps.diff.outputs.stdout == '' }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: diff | |
hide: true | |
hide_classify: "OUTDATED" | |
- name: Post comment with diff in original PR | |
if: ${{ github.event_name == 'pull_request' && steps.diff.outputs.stdout }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
header: diff | |
message: | | |
This PR introduces the following changes in the developer-portal documentation: | |
```diff | |
${{ steps.diff.outputs.stdout }} | |
``` | |
- name: Create PR to developer-portal repo | |
id: cpr | |
uses: peter-evans/create-pull-request@v6 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
path: developer-portal | |
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 }}" |