GitHub Push (Legacy)

Important

GitHub Push is deprecated. Use GitHub Sync instead.

You can have SwaggerHub push your API or domain definitions to a GitHub repository every time you save the API or domain in SwaggerHub. GitHub Push is configured for a specific version of the API, so you can have different API versions pushed to different branches or repositories.

GitHub Push supports OpenAPI 2.0 and 3.0 definitions.

Configure GitHub Push

  1. Open the API or domain page in SwaggerHub.

  2. If the API or domain has several versions, select the version you want to store on GitHub.

    Selecting an API version
  3. In the top right corner, click settings.png and select Edit GitHub Push.

  4. Enter the information about the GitHub repository where you want to store your OpenAPI definition:

    GitHub Push Settings

    Click the image to enlarge it.

    • Access Token – A GitHub access token. To learn how to generate a token, see Creating an access token for command-line use in GitHub documentation. A token must have the public_repo scope if the target GitHub repository is public, or the repo scope if it is private.

    • Repository Owner – The GitHub username of the owner of the GitHub repository.

    • Repository Name – The name of the GitHub repository where you want to push the API or domain definition to.

    • Branch – The name of the branch in the repository where the API definition will be pushed to. This branch must exist.

    • Path to OpenAPI file – The name and path of the file where your API definition will be saved (it is relative to the repository root). For example, openapi.json or spec/petstore.yaml. The file extension (.json or .yaml) determines the format.

    • Notification Email – The email address to which SwaggerHub will send notifications about unsuccessful push attempts.

    • Enable – Select this check box to enable GitHub Push, or unselect it to temporarily disable GitHub Push.

  5. Click Save.

Upon saving the changes, SwaggerHub validates the parameters. If it finds issues, you will see an error message on screen.

If everything is fine, then every time you save this version of the API or domain, SwaggerHub will push it to the specified GitHub repository.

Notes

GitHub Push commits will appear on behalf of your GitHub user account and with the commit message in the format {apiOwnerId}/{apiName}:{version}.

If GitHub Push fails (for example, due to insufficient permissions), you will receive an email notification, and GitHib Push will be disabled until you enable it again.

See Also

Publication date: