Export GitHub access updates to a CSV file using Baton
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
.csvfile
Before you begin
Before you begin, make sure you have everything from the list below:
- A GitHub account
Part one: Set up baton and baton-github
Use this commands to install the Baton SDK and Baton GitHub connector:
$ brew install conductorone/baton/baton conductorone/baton/baton-githubIf you don’t have Homebrew installed yet, follow this guide.
Run the
batontool 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.
c1zfiles 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 thesync.c1zfile 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.
Create a new GitHub Personal Access Token with the following permissions:
Area Scope of access repo All admin:org All user All Save your Personal Access Token. You will need it in step 3.
Run the
baton-githubconnector, 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: