Create PRs for your SDKs
These commands help with publishing your SDK.
Command | Description |
---|---|
liblab pr | Create a PR for all the generated SDKs |
liblab pr
Create a pull request (PR) in GitHub for all the generated SDKs. This command is generally intended to be run from a CI/CD pipeline.
liblab pr [--org=<value>]
To raise a PR, you need to specify the organization or user. as well as the repo names that you want to create the PR in. The organization is set either in the config file in the publishing/githubOrg
section, or by passing it to the command using the --org
flag. The repo is also set in the config file, in the githubRepoName
field for each language. Each SDK is published to a different repo.
{
...
"publishing": {
"githubOrg": "exciting-soda"
},
"languageOptions": {
"typescript": {
"githubRepoName": "exciting-soda-sdk-python"
},
"python": {
"githubRepoName": "exciting-soda-sdk-python"
},
"java": {
"githubRepoName": "exciting-soda-sdk-python"
}
}
}
For the liblab CLI to be able to create a PR, it needs a fine-grained GitHub access token with the following repository permissions for the repos you want to create the PR in.
Permission | Access |
---|---|
Commit Statuses | Read/Write |
Contents | Read/Write |
Metadata | Read |
Pull Requests | Read/Write |
Workflows | Read/Write |
This token needs to be set in an environment variable called GITHUB_TOKEN
. This can be done from your terminal, or set in your CI/CD pipeline.
This command will create a new branch in each SDK repo with a unique name, and commit the code to this branch. It will then raise a PR to merge this code into the default branch of the repo (such as main). When this command completes, you will have a PR raised in the given repos with the latest SDK code:
This can then be reviewed and merged when you are ready.
If you get the following error when running this command:
Error: Unable to create branch for <language>
You will need to check the permissions of your GitHub token, or your config file.
- If this is for all SDK languages, then check your access token:
- Check that the token has the required permissions for all the SDK repositories listed in your config file
- If you are part of a GitHub organization and not an admin, the token you create might be pending approval. If you do not have admin permissions, you may have had to fill in a field describing why your personal access token needs access to your organization. In this case, check with your organization admins to approve the token.
- If the error is only for one SDK language, check that the repo name is correct in the configuration file options for that language.
Optional parameters
Parameter | Description |
---|---|
--org -o | The GitHub organization to create the PR in. |
org
The GitHub organization to create the PR in. This overrides the organization set in the config file.
liblab pr --org=exciting-soda