Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ Download the binary for your platform from the `latest` release and run it local

The included GitHub Actions workflow (`.github/workflows/mockzilla.yml`) publishes your server to [Mockzilla](https://mockzilla.org) automatically:

- **Push to main/master** — builds and publishes the server to your main simulation
- **Pull request with `Mockzilla` label** — deploys a preview simulation for the PR (torn down when the PR is closed)
- **Push to main/master**: builds and publishes the server to your main simulation
- **Pull request with `Mockzilla` label**: deploys a preview simulation for the PR (torn down when the PR is closed)
- **Run by hand**: takes the mocks down and frees your simulation slot

The `Mockzilla` label is created automatically on first push via the setup workflow.
Expand All @@ -118,8 +118,15 @@ push and pull request triggers cannot pass an input, which is what the
repository occupies the single slot.

Your simulation will be available at:
- `https://api.mockzilla.org/gh/{org}/{repo}/` — main branch
- `https://api.mockzilla.org/gh/{org}/{repo}/pr-{n}/` — per pull request
- `https://{label}.api.mockz.io`: main branch
- `https://{label}-pr{n}.api.mockz.io`: per pull request
- `https://{label}-{branch}.api.mockz.io`: any other branch you add to the workflow's `push` trigger

The label is the repo name as a host name, up to 55 characters, with `-2`, `-3` if
it is taken. It never ends in `-pr` and digits, which is kept for pull requests. The
`host` input asks for another before the first deploy. A branch has its name in its
host, lowercased, with everything but letters and digits removed: `feature/new-api`
gives `{label}-featurenewapi`. Branches deploy on plans with PR environments.

### Action inputs

Expand All @@ -129,19 +136,19 @@ You can customize the action in `.github/workflows/mockzilla.yml`:
- uses: mockzilla/actions/codegen@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
region: us-east-1 # optional — preferred AWS region, used as a hint on first deploy only
region: us-east-1 # optional. Preferred AWS region, used as a hint on first deploy only.
environment: '{"ENV":"production","DEBUG":"true"}' # optional
host: api.mockzilla.net # optional — API host for the simulation URL
timeout-minutes: 5 # optional — max minutes to wait for simulation to become active (default: 5)
delete: false # optional — remove this repository from Mockzilla (default: false)
host: mockzilla.net # optional. A domain, or a label on one (petstore.mockzilla.net).
timeout-minutes: 5 # optional. Max minutes to wait for simulation to become active (default: 5).
delete: false # optional. Remove this repository from Mockzilla (default: false).
```

| Input | Required | Description |
|---|---|---|
| `token` | yes | `GITHUB_TOKEN` — used to verify repo identity |
| `region` | no | Preferred AWS region (e.g. `us-east-1`, `ap-southeast-1`). Used as a hint on first deploy — if at capacity, the nearest available region is used. Has no effect after the simulation is deployed. |
| `token` | yes | `GITHUB_TOKEN`, used to verify repo identity |
| `region` | no | Preferred AWS region (e.g. `us-east-1`, `ap-southeast-1`). Used as a hint on first deploy. If at capacity, the nearest available region is used. Has no effect after the simulation is deployed. |
| `environment` | no | JSON object of environment variables to set in the simulation (e.g. `'{"ENV":"production"}'`). |
| `host` | no | API host for the simulation URL (`api.mockzilla.org`, `api.mockzilla.de`, or `api.mockzilla.net`). Defaults to org setting or `api.mockzilla.org`. |
| `host` | no | The domain the simulation answers on: `mockz.io`, `mockz.net`, `mockz.org`, `mockzilla.org`, `mockzilla.de` or `mockzilla.net`. Put a label in front to ask for it: `petstore.mockz.io` answers at `https://petstore.api.mockz.io`. Fixed at the first deploy. Defaults to the org setting or `mockz.io`, with the repo name as the label. |
| `timeout-minutes` | no | Max minutes the action polls for the simulation to become active. Defaults to `5`. |
| `delete` | no | Remove this repository from Mockzilla. When set to `true`, the action skips publishing and deletes all mock APIs for this repo. Useful on the free plan to free up your slot before connecting a different repository. Defaults to `false`. |

Expand Down
Loading