tikoci / restraml

RouterOS REST API "Schema Tools"
https://tikoci.github.io/restraml/
The Unlicense
12 stars 0 forks source link

GitHub Action to generate scheme, at least semi-manually via workflow_dispatch trigger. #3

Closed mobileskyfi closed 3 months ago

mobileskyfi commented 3 months ago

There is no GitHub Action to automatically build the RAML schema today. While these are generally pretty trivial, the issue here is that the JavaScript code needs to have a running RouterOS to run against. GitHub Actions can easily spin up a containers, but CHR does not run in Docker. Anyway, more automated this is tricky than it would seem.

But one way to skin this cat is GH manually triggered workflow via "workflow_dispatch", instead of usual "on: push". The workflow_dispatch can take parameters. Those parameters could be the IP/user/password of a router that was setup.

See: https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_dispatch

mobileskyfi commented 3 months ago

Done. Now schema building is automated. See GitHub workflows: https://github.com/tikoci/restraml/tree/main/.github/workflows

In two ways:

Both have a dropdown to start a build within the workflow on GitHub Actions. Partial schema generation is support by passing the space seperated path like ip address as the path. And resulting schemas are "published" (i.e. git add/commit/push to /docs in repo) - so they are directly downloadable from built-in Github Pages.

Should update readme and other docs... but closing.