How to Export Commit and Pull Request Data from Bitbucket to CSV

June 18, 2024
#How To#Bitbucket#Reporting
13 min

Being a universal file type, CSV serves as a go-to format for integrations between the applications. It allows for transferring a large amount of data across the systems, blending it, and building custom reports. To export commit and pull request data from Bitbucket Data Center to a CSV file, you can use the Awesome Graphs for Bitbucket app.

In this article, we’ll show you two ways how to use the app to export engineering data to CSV for further integration, organization, and processing in analytics tools and custom solutions.

What commit and pull request data you will get

The methods described later in the article will give you two kinds of generated CSV files, depending on whether you export data about commits or PRs.

In the case of commit data, you’ll get a list of commits with the following details:

  • creation date
  • author’s email, name, and username
  • repository and project name
  • commit hash
  • whether it is a merge commit or not
  • number of lines of code added and deleted

commits export

The resulting CSV with a list of pull requests will contain the following information:

  • pull request creation and last updated date 
  • author’s name and username
  • repository and project name
  • PR state and its ID
  • reviewers’ names and usernames
  • PR cycle time and its phases: time to open, pickup time, review time, time to resolve

pull request (PR) export

Exporting from the People page

You can export raw commit and pull request data to CSV directly from Bitbucket. When you click All users in the People dropdown menu at the header, you’ll get to the People page with a global overview of developers’ activity based on the number of commits or pull requests.

At the top-right corner, you’ll notice the Export menu, where you can choose CSV.

Export Commit and Pull Request Data from Bitbucket

By default, the page shows developers’ contributions made within a month, but you can choose a longer period up to a quarter. The filtering applies not only to the GUI but also to the data exported, so if you don’t change the timespan, you’ll get a list of commits or pull requests for the last 30 days.

Exporting via the REST API resources

Awesome Graphs REST API allows you to retrieve and export commit and pull request data to a CSV file on global, project, repository, and user levels. This functionality is aimed to automate the processes you used to handle manually and streamline the existing workflows.

To find the REST API resources, you can go to the in-app documentation by choosing Export → REST API on the People page (accessible to Awesome Graphs’ users), or to our documentation website.

In the article, we’ll show you two examples of the resources and how they work: one for exporting commits and another for pull requests. The rest of the resources follow the same model, so you can apply these principles to get the data you need.

Export commits to CSV

This resource exports a list of commits with their details from all Bitbucket projects and repositories to a CSV file.

Here is the curl request example:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/export/csv"

Alternatively, you can use any REST API client like Postman or put the URL directly into your browser’s address bar (you need to be authenticated in Bitbucket in this browser), and you’ll get a generated CSV file.

By default, it exports the data for the last 30 days. However, you can set a timeframe for exported data up to one year (366 days) with sinceDate / untilDate parameters:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/export/csv?sinceDate=2024-05-01&untilDate=2024-05-15"

For commit resources, you can also use the query parameters such as merges to filter merge/non-merge commits or order to specify the order to return commits in.

You can read more about this resource and its parameters in our documentation, as well as find other resources for exporting commit data on project, repository, and user levels.

Export pull requests to CSV

The pull request resources work similarly, so to export a list of pull requests with their details from all Bitbucket projects and repositories to a CSV file, you need to make the following curl request:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/pull-requests/export/csv"

The sinceDate / untilDate parameters can also be applied to state the timespan up to a year, but here you have an additional parameter dateType, allowing you to choose either the creation date or the date of the last update as a filtering criterion. So, if you set dateType to created, only the pull requests created during the stated period will be returned, while dateType set to updated will include the pull requests that were updated within the time frame.

Another pull request specific parameter is state, which allows you to filter the response to only include openmerged, or declined pull requests.

For example, the following request will return a list of open pull requests, which were updated between May 1st and May 15th:

curl -X GET -u username:password "https://bitbucket.your-company-name.com/rest/awesome-graphs-api/latest/commits/export/csv?dateType=updated&state=open&sinceDate=2024-05-01&untilDate=2024-05-15"

Refer to our documentation for more details about this resource and its parameters. Additionally, you can find information on other resources for exporting pull request data at the project, repository, and user levels.

Integrate intelligently

While CSV is supported by many systems and is quite comfortable to manage, it is not the only way for software integrations the Awesome Graphs for Bitbucket app offers. Using the REST API, you can make data flow between the applications, automate the workflow, and get custom reports tailored to your needs.

For Awesome Graphs Data Center clients, we offer a Premium Support subscription aimed at enhancing efficiency and saving time while working with our app and its REST API resources. It includes personalized assistance from our experts who will create scripts in Python, Bash, Java, or Kotlin to interact with our REST APIs and build reports tailored to your specific requirements. By using these advanced capabilities, our clients optimize their workflows, gain deeper insights into their engineering activities, and drive informed decision-making.

Related posts

    How to Create Powerful Spreadsheets in monday.com

    May 30, 2023
    #Project management#Task Management#Document management#Reporting#How To#Collaboration#monday
    11 min

    If you use monday.com, you know for sure that this tool can take your team’s collaboration and productivity to the next level. This powerful platform is designed to help teams work together more effectively, with features that support everything from project management to task tracking and more. In this article, we will share with you how you can empower your team to reach their business goals faster, with greater efficiency and accuracy than ever before, and create spreadsheets in monday.com.

    Why choose monday.com?

    One of the best things about monday.com is its ease of use. Simply create an account and start building your team’s boards and workflows. No programming or DevOps skills are needed to start. Just take the monday.com ready-to-go solution, and adjust it to your business goals. Whether you’re working on a small project with a few team members or managing a large-scale enterprise initiative, monday.com has the tools you need to keep everyone on the same page and working together towards success. And because it’s cloud-based, you can access your projects from anywhere, at any time.

    One of the key benefits of monday.com is its ability to streamline team collaboration. With features like customizable boards and timelines, you can easily track tasks and projects across your entire team, ensuring that everyone is on the same page and working towards the same goals. With monday.com automations and deadline tracking, you can ensure that every member of your team is working efficiently and effectively towards your shared goals.

    Why go to the marketplace?

    If you need to make more complex operations like calculations, you can empower your monday.com with different integrations or marketplace apps. They will easily connect monday.com to the other tools your team relies on every day. The marketplace has loads of apps. So how do you choose the right one? And how do you add the app to your monday.com account?

    Easy as it is, you need to look around for a start. Once all apps may look the same at the first marketplace visit, they turn different after a while. We suggest setting your business goals in advance so that you clearly understand what you are looking for when you’re headed to the app marketplace. It will prevent you from long-lasting listing browsing without any purpose. Instead, you can start your marketplace journey with a clear plan and save time.

    Now that you know what you need, the app discovery on the monday.com marketplace turns from a chaotic action into a plan. Start with the keyword lookup using the monday.com search engine. Just type what you’re interested in, and here you have the appropriate apps to choose from.

    Browse apps

    After that, you can take the time and dive into the app details. To be sure of the quality of an app before you integrate it into your monday.com account, you can check the ratings left by other trusted monday.com users or look at the number of app installs on the marketplace. You’ll find these numbers next to the vendor name. Treat the number this way: the number of installs is equal to the number of monday.com accounts that initialized the app installation to their host. So whom do you trust more: the vendor with 500 installs or 1.5k installs? You decide!

    Another thing to look at is the presence of the app appraisal signs, like Editor’s choice, Featured, or Best sellers. You’ll find those apps grouped in separate monday.com marketplace categories on the left sidebar. Another way is to look at the app marketplace page. The sign of being in one of the marketplace categories appears in the form of a respectful badge.

    Marketplace categories

    App ratings are also important. In monday.com, only commercial verified users can rate the apps they are using to ensure the accuracy of the app performance you can see on the marketplace. You don’t necessarily need to take the app rating for granted, as we are all humans with different expectations and business needs. Still, rating is something we definitely suggest looking at when you are reviewing the app.

    App ratings

    Now you have a better understanding of how to differentiate between the marketplace apps. It’s high time to think of the business cases that can be better managed in your monday.com account and find the right tool for that.

    Why create spreadsheets in monday.com?

    The boards of monday.com are awesome. They keep your daily work organized, make processes transparent, and even allow you to do simple math. If you want to use Excel-like formulas and functions to perform complex calculations, you can try our Smart Spreadsheet for monday.com.

    This app helps you create, edit, and keep your Excel-like spreadsheets secure on monday.com. No more struggling to choose between real-time collaboration with your teammates in monday.com and powerful Excel functionality. Smart Spreadsheet brings it all together to your account. It can help your team work together more effectively and reach your business goals faster than ever before.

    Once the app is installed, you can add it to any monday.com component: dashboard widget, item view, custom object, docs, and board view. Click Add view > Apps > Installed Apps and select Smart Spreadsheet. The blank spreadsheet will immediately appear, but you can import external or monday.com data to it if needed.Сreate spreadsheets in monday

    You can reuse your data from external sources like Google or Excel by importing it to our Smart Spreadsheet for monday.com. Just select File > Import and add the required file to add its data to the spreadsheet. Your external data will immediately appear in the spreadsheet, so your teammates will need no other switch between several resources. You can take advantage of powerful Excel formulas, add filters, and build pivot tables and charts directly in monday.com.Import Google or Excel files

    Marketing and product teams, project managers and business owners, HR and IT teams – whatever your role is, you will work with your data faster in the Smart Spreadsheet. This app has advanced calculating capabilities and flexible filtering and sorting. You can format your table content in the spreadsheet to make it more digestible or add data type to your cells. The intuitive controls on the top bar of Smart Spreadsheet will help you do it in a few clicks. Your team will streamline the data processing with time-saving shortcuts to copy, cut, and paste the spreadsheet data or undo and redo operations.Advanced calculation

    If you want to work with the data you already have in monday.com, you can also import the board to our spreadsheet. To do so, you need to select File > Import board and add the information from the connected board will be imported to the spreadsheet immediately. This way, you can enjoy the intuitive monday.com board view and work on complex data in one place without leaving the platform.Import board

    For cases when you need to share a particular piece of data from the monday.com account, you can export spreadsheets. To do so, click File > Export and select the name and format for your file. This functionality is required for easy sharing and further usage of your data.Export spreadsheet

    Why wait?

    Smart Spreadsheet makes it possible to import Excel and Google Docs files into monday.com to keep them secure and work on them with ease. No more switching between platforms to work with table data or struggle missing the calculations for complex business cases. You can try the app for free on the monday.com marketplace and see if it adds to your team’s productivity. The app has a flexible pricing model making it the perfect choice for teams of all sizes and industries.