Align README example with the Test Action readme by including the checkout step #27
Workflow file for this run
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: Deploy Action | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
name: Deploy Authorization Model | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: jaxxstorm/action-install-gh-release@25d5e2dd555cd74f1fab9ac1e6ea117acde2c0c4 | |
with: | |
repo: openfga/openfga | |
cache: enable | |
- name: Run a local OpenFGA Server | |
shell: bash | |
## The key used here is a mock for demo purposes only | |
run: | | |
openfga --authn-method preshared --authn-preshared-keys key1 run& | |
- name: Create a store | |
shell: bash | |
run: | | |
curl -X POST http://localhost:8080/stores -H "content-type: application/json" -H "Authorization: Bearer key1" -d '{"name": "FGA Demo Store"}' > id.json | |
- name: Get store ID | |
id: get-store-id | |
shell: bash | |
run: | | |
echo "store_id=$(jq -r '.id' id.json)" >> "$GITHUB_OUTPUT" | |
- name: Deploy using a file | |
id: deploy-file | |
uses: ./ | |
with: | |
api-url: http://localhost:8080 | |
api-token: key1 | |
store-id: ${{ steps.get-store-id.outputs.store_id }} | |
model-file-path: ./example/model.fga | |
- name: Output the model ID | |
run: | | |
echo "The model ID is ${{ steps.deploy-file.outputs.authorization_model_id }}" | |
- name: Deploy using a string | |
id: deploy-string | |
uses: ./ | |
with: | |
api-url: http://localhost:8080 | |
api-token: key1 | |
store-id: ${{ steps.get-store-id.outputs.store_id }} | |
format: json | |
model: '{\"schema_version\":\"1.1\",\"type_definitions\":\[\{\"type\":\"user\"\},\{\"type\":\"document\",\"relations\":\{\"reader\":\{\"this\":\{\}\},\"writer\":\{\"this\":\{\}\},\"owner\":\{\"this\":\{\}\}\},\"metadata\":\{\"relations\":\{\"reader\":\{\"directly_related_user_types\":\[\{\"type\":\"user\"\}\]\},\"writer\":\{\"directly_related_user_types\":\[\{\"type\":\"user\"\}\]\},\"owner\":\{\"directly_related_user_types\":\[\{\"type\":\"user\"\}\]\}\}\}\}\]\}' | |
- name: Output the model ID | |
run: | | |
echo "The model ID is ${{ steps.deploy-string.outputs.authorization_model_id }}" |