GitHub: Automate adoption measurement with GitHub actions

Vinh
Vinh
  • Updated

Package version monitoring and component usage can be automated using our GitHub action, allowing you to keep zeroheight up to date with your codebase

Design system adoption action on GitHub marketplace

How to get set up

Follow the steps to set up the CLI tool for Package Version Monitoring and Component usage metrics

In GitHub, head to your repository and then Settings. Open the Actions page under Secrets and variables

Click New repository secret and enter ZEROHEIGHT_CLIENT_ID as the name and add the Client ID you generated in zeroheight as the value.

Repeat this for ZEROHEIGHT_ACCESS_TOKEN using the Access Token you generated in zeroheight.

Using the action

Update your GitHub actions workflow yaml to include a step to run the action. We recommend having it as part of a workflow that is regularly triggered from updates to your main branch

For example, if you wanted to run the track-package command from the @zeroheight/adoption-cli you would provide it as the command in the action inputs:

  - name: Analyze design system adoption data
    uses: zh-ski/action-design-system-adoption@v2
    with:
      command: 'track-package'
    env:
      ZEROHEIGHT_CLIENT_ID: "${{ secrets.ZEROHEIGHT_CLIENT_ID }}"
      ZEROHEIGHT_ACCESS_TOKEN: "${{ secrets.ZEROHEIGHT_ACCESS_TOKEN }}"

Optionally, you can include arguments for the command.

For example if you wanted to ignore all spec files when running the analyze command you would provide it in the arguments in the action inputs:

  - name: Track package version
    uses: zh-ski/action-design-system-adoption@v2
    with:
      command: 'analyze'
      arguments: '--ignore "**/*.spec.*'
    env:
      ZEROHEIGHT_CLIENT_ID: "${{ secrets.ZEROHEIGHT_CLIENT_ID }}"
      ZEROHEIGHT_ACCESS_TOKEN: "${{ secrets.ZEROHEIGHT_ACCESS_TOKEN }}"

You can see more information about the arguments and commands in the @zeroheight/adoption-cli readme and more information about the Github action in the Design system adoption action on GitHub marketplace

Was this article helpful?