Skip to content

Commit

Permalink
ci: test swagger on pull_request
Browse files Browse the repository at this point in the history
  • Loading branch information
altergui authored and p4u committed Mar 19, 2024
1 parent 74ad01c commit 5b7e90a
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
push:
branches:
- main
pull_request:
paths:
- 'api/**/*'

jobs:
api-swagger:
Expand Down Expand Up @@ -38,27 +41,29 @@ jobs:
name: vocdoni-api.yaml
path: api/docs/vocdoni-api.yaml

- name: Get short commit hash
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

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
path: developer-portal

- name: Copy generated docs
run: cp -f ./api/docs/vocdoni-api.yaml ./developer-portal/swaggers/vocdoni-api.yaml
- uses: actions/download-artifact@v4
with:
name: vocdoni-api.yaml
path: swaggers/vocdoni-api.yaml

- 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@v4
with:
token: ${{ secrets.VOCDONIBOT_PAT }}
path: developer-portal
commit-message: "Update vocdoni-api docs by commit ${{ steps.vars.outputs.sha_short }}"
commit-message: "Update vocdoni-api docs by commit ${{ env.SHA }}"
committer: "Arabot-1 <[email protected]>"
base: main
branch: update-api-docs
Expand Down

0 comments on commit 5b7e90a

Please sign in to comment.