Automatically run Speakeasy tests on SDK pull requests or other events in a GitHub repository via GitHub Actions.
github.com
github.com
Setting up a Github Actions Check
This requires previously completing the Github Setup.
After completing the setup, navigate to the SDK repository and run the following command:
This command enables both generateTests and generateNewTests settings in your gen.yaml configuration file and produces a Github Actions workflow like the following that enables running SDK tests as a Github check on Pull Requests.
Ensuring Tests Run on Automated PR Creation
Warning
Pull requests created by the action using the default GITHUB_TOKEN cannot trigger other workflows.
When you have on: pull_request or on: push workflows acting as checks on pull requests, they will not run by default.
To ensure that testing checks run by default when an SDK PR is created, implement one of the following options.
Installing the Speakeasy Github App
Installing the Speakeasy Github App and granting the App access to the SDK repository enables triggering testing runs after a PR is created.
To install the app, visit this link or follow instructions in the CLI or dashboard.
Setting up your own Github PAT
Another option is to create a Github Personal Access Token (PAT) that will be used to create PRs in the SDK repository.
This is a workaround recommended by Github.
Create a fine-grained PAT with Pull requests Read/Write permissions. Ensure it has access to the SDK repository. Setting this to no expiration is recommended.
github.com
github.com
github.com
In all SDK repositories, navigate to Settings > Secrets and variables > Actions and save the PAT as a Repository secret under the name PR_CREATION_PAT.
github.com
In all sdk_generation.yaml workflows, add the pr-creation-token as a provided secret at the bottom.
Running in Direct mode
If your generation action is running in direct mode where SDK updates get immediately pushed to main, testing will run as part of the generation action.
If tests fail, the generation action will fail and not push your SDK changes to main.