GitHub Action to fetch Angular routes from an API and save it to a file for SSG builds.
Heavily based on https://github.com/gautemo/fetch-api-data-action.
Required The url to fetch routes from.
Expected Response type ("json" or "text"). Default json
Response property containing the list of routes. Default null
The file data is saved to. Default routesFile.txt
Debug mode: logs additional informations - "true" or "false". Default false
Use this action before the "Build" step in your workflow, as Angular will need the routes file to build the application.
In your angular.json file, set the routesFile property to the file option value:
{
"projects": {
"my-app": {
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"prerender": {
"routesFile": "routesFile.txt"
}
}
}
}
}
}
}More information on Angular SSG configuration: Angular Docs
{
"data": {
"routes": [
"posts/1",
"posts/2",
"posts/3",
"posts/4",
"posts/5",
"posts/6"
]
}
}uses: tegain/angular-ssg-async-routes-file-action@1.0.0
with:
url: 'https://my-api.com/angular-routes'
file: 'folder/to/routes.txt'
responsePath: 'data.routes'
posts/1
posts/2
posts/3
posts/4
posts/5
posts/6
uses: tegain/angular-ssg-async-routes-file-action@1.0.0
with:
url: 'https://my-api.com/angular-routes'
file: 'folder/to/routes.txt'
type: 'text'
debug: 'true'