Skip to content

Commit

Permalink
Add replace-all option (#2)
Browse files Browse the repository at this point in the history
* Add replace-all option

* Update README.md
  • Loading branch information
svix-lucho authored Jan 14, 2025
1 parent 646cda9 commit d154856
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Your [Svix API key](https://docs.svix.com/api-keys).
**Optional**
Override the Svix API URL. If not set, the URL will be determined using the API Key.

### `replace-all`
**Optional**
If true, archives all existing event types that are not in the OpenAPI spec. Default: `false`.

## Usage

To use this GitHub Action in your workflow, you can add the following step:
Expand Down
18 changes: 11 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
name: 'Upload Event Types to Svix'
description: 'Upload Event Types from an OpenAPI spec to Svix'
name: "Upload Event Types to Svix"
description: "Upload Event Types from an OpenAPI spec to Svix"
inputs:
openapi-file:
description: 'Location of the OpenAPI spec file (JSON or YAML)'
description: "Location of the OpenAPI spec file (JSON or YAML)"
required: true
svix-api-key:
description: 'Svix API key'
description: "Svix API key"
required: true
svix-api-url:
description: 'Override Svix API URL'
description: "Override Svix API URL"
required: false
replace-all:
description: "Archive all existing event types that are not in the OpenAPI spec"
required: false
default: "false"
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -44,7 +48,7 @@ runs:
- name: Upload OpenAPI spec to Svix
run: |
TMP_PAYLOAD=$(mktemp)
python3 -c "import json; print(json.dumps({'specRaw': open('./${{inputs.openapi-file}}','r').read()}))" > $TMP_PAYLOAD
python3 -c "import json; print(json.dumps({'specRaw': open('./${{inputs.openapi-file}}','r').read(), 'replaceAll': 'true' == '${{inputs.replace-all == 'true' || inputs.replace-all == true}}' }))" > $TMP_PAYLOAD
echo "Uploading OpenAPI spec to https://$SVIX_API_URL/api/v1/event-type/import/openapi/"
Expand All @@ -55,4 +59,4 @@ runs:
--data-binary "@$TMP_PAYLOAD" | jq
rm $TMP_PAYLOAD
shell: bash
shell: bash

0 comments on commit d154856

Please sign in to comment.