Shine a light on shadow apps

Baton Docs

Export GitHub access updates to a CSV file using Baton

In this guide we will show you how to do a simple .csv export of GitHub user rights using the Baton GitHub connector.

After reading this guide, you will be able to:

  • Understand how the Baton SDK works
  • Understand how to connect Baton SDK to your GitHub instance
  • Understand how to use the CLI
  • Understand how to export results in a .csv file

Before you begin

Before you begin, make sure you have everything from the list below:

Part one: Set up baton and baton-github

  1. Use this commands to install the Baton SDK and Baton GitHub connector:

    $ brew install conductorone/baton/baton conductorone/baton/baton-github
    

    If you don’t have Homebrew installed yet, follow this guide.

  2. Run the baton tool by using this command:

    $ baton --help
    

After running baton, you will see a console with all available commands. You can find a list of all the commands in our getting started guide, where we explain them in detail.

Now you have the baton ready to use. It’s time to show you how to use baton-github to create a c1z file.

About the c1z file

Once we’ve successfully run the baton-github connector, we will be left with a new c1z file.

  • c1z files contain all of the information that the connector has collected as part of a synchronization process. Using the Baton CLI, you can browse the contents of the sync.c1z file and export that data to a .csv or .xlsx file.

Part two: Connect GitHub connector

The Github connector allows you to manage access rights for all users across all repositories. Setting up the connector is very simple, so let’s take a look at how to do it.

  1. Create a new Github Personal Access Token with the following permissions:

    AreaScope of access
    repoAll
    admin:orgAll
    userAll
  2. Save your Personal Access Token. You will need it in step 3.

  3. Run the baton-github connector, passing in the token value you just created.

$ BATON_TOKEN=<github access token goes here> baton-github --orgs <github org>

Now that you’ve run baton-github successfully, you should find a new sync.c1z file in your working directory.

Part three: Export your .csv files from GitHub

For exporting your data from Github run this command:

$ baton export csv

This command creates a new file (sync.csv) in your current directory.

What’s next?

Wasn’t that easy? This integration is the entry point to the Baton project. The Baton ecosystem aims to simplify gathering information from a number of other systems, including AWS and MySQL. You can even use the SDK to build your own connector for your internal applications or any other service that you’d like.

See how to use the Baton SDK for your application or check out our other tutorials to discover the full potential of Baton: