Skip to main content

Create PRs for your SDKs

These commands help with publishing your SDK.

CommandDescription
liblab prCreate a PR for all the generated SDKs

liblab pr

Create a pull request (PR) in GitHub for one or all the generated SDKs. This command is generally intended to be run from a CI/CD pipeline. You can learn more about the PR process in our PR creation guide.

liblab pr [--org=<value>]
[--liblab-config=<value>]
[--language=<language>]

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"
},
"csharp": {
"githubRepoName": "exciting-soda-sdk-csharp"
},
"go": {
"githubRepoName": "exciting-soda-sdk-go"
},
}
}

For the liblab CLI to be able to create a PR, it needs a fine-grained GitHub access token set in an environment variable called LIBLAB_GITHUB_TOKEN, This token should be scoped to just the SDK repos that you want to raise PRs in, and needs the following repository permissions.

PermissionAccess
Commit StatusesRead/Write
ContentsRead/Write
MetadataRead
Pull RequestsRead/Write
WorkflowsRead/Write

When you set these permissions, you will see the following:

The required permissions The required permissions

note

You will need to use a fine-grained token, not a classic token.

This token can be set from your terminal for local testing, and configured as an environment variable in your CI/CD pipeline.

note

If you get the following error when running liblab pr 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:
    • Verify that the GitHub organization is correctly set in the liblab config file
    • Check that your access 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 access 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 GitHub repo name is correct in the liblab config file options for that language.

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:

A PR raised with an SDK update A PR raised with an SDK update

This can then be reviewed and merged when you are ready.

Optional parameters

Parameter                                                        Description
--org <org name> -o <org name>The GitHub organization to create the PR in. This overrides the organization set in the config file.
--liblab-config <value>The path to your liblab config file. This can be a local path or a publicly reachable URL. If this is not set, the default config file path is liblab.config.json in the current working directory.
--language -lRaise a PR just for the specified SDK language. If this is not set, PRs are raised for all languages specified in the liblab config file.