Skip to main content

GitHub Actions

GitHub Actions allow you to establish CI/CD pipelines and automate workflows directly into your GitHub repositories. APIMatic offers a GitHub Action to integrate API Transformer into your workflows so that every time your API specification is updated, the GitHub Action converts the file into your desired supported formats instantly.

  • On your GitHub repository, create an action workflow file by clicking on the Actions tab. The workflow file will contain steps that will be logged once they are triggered.

  • Click on Set up a workflow yourself to create the .github/workflow YML file.

  • In this file, you check out the repository via the actions/checkout@v2 action. Then specify the apimatic/apimatic-transformer-action@v0.1 action. You only need to provide the API specification URL (inputURL), export format (exportFormat) and authorization secret (auth) as arguments to the action.

A sample of the workflow file is shown as follows. For the complete workflow file, refer to the GitHub Action Marketplace.

steps:
# you must check out the repository
- name: Checkout
uses: actions/checkout@v2
- name: APIMatic Transformer
uses: apimatic/apimatic-transformer-action@v0.1
id: transform
with:
auth: ${{ secrets.Test }}
inputURL: 'https://github.com/path/to/api-to-convert.json'
exportFormat: 'raml'
# Use the Transformed API Spec as output from our action (id:transform)
- name: Get the API Spec URL
run: echo "${{ steps.transform.outputs.specurl }}"
  • Save the file and commit your changes. The next time your API changes, this GitHub Action will be triggered to provide the URL to the converted API specification in the format specified.

APIMatic Transformer GitHub Action