docs.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. name: Generate Documentation
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. branch:
  6. description: 'Branch to run the workflow against'
  7. required: true
  8. default: 'master'
  9. jobs:
  10. generate-docs:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout
  14. uses: actions/checkout@v4
  15. with:
  16. repository: gravitl/netmaker
  17. ref: ${{ github.event.inputs.branch || 'master' }}
  18. - name: Setup Go
  19. uses: actions/setup-go@v5
  20. with:
  21. go-version-file: go.mod
  22. - name: Install Swag
  23. run: go install github.com/swaggo/swag/cmd/swag@latest
  24. - name: Generating Docs
  25. run: |
  26. export PATH=$PATH:$(go env GOPATH)/bin
  27. swag i --md docs/ --parseDependency --parseInternal --outputTypes yaml --parseDepth 1 --output .
  28. - name: Get current timestamp
  29. id: timestamp
  30. run: echo "timestamp=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
  31. - name: Create Pull Request
  32. uses: peter-evans/create-pull-request@v7
  33. with:
  34. token: ${{ secrets.GITHUB_TOKEN }}
  35. commit-message: "Update documentation ${{ steps.timestamp.outputs.timestamp }}"
  36. title: "Update Swagger documentation ${{ steps.timestamp.outputs.timestamp }}"
  37. body: |
  38. This PR updates the swagger.yml file with the latest documentation changes.
  39. Updated on: ${{ steps.timestamp.outputs.timestamp }}
  40. branch: update-swagger-docs-${{ github.event.inputs.branch }}
  41. base: ${{ github.event.inputs.branch }}
  42. delete-branch: true