Skip to content

codedeman/Automation-Hub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

🚀 Merge Request Tracker to Google Sheet

This script collects open Merge Requests (MRs) from GitLab and syncs them to a Google Sheet. Super useful for tracking bugs, tasks, and stories across projects — all in one place. 📊✨


📦 Requirements

You’ll need Python 3.8 or later.

Install dependencies:

pip install requests pandas gspread oauth2client

Libraries used:

Library Purpose
requests Makes HTTP requests to the GitLab API
pandas Handles tabular data, making it easy to format and convert to spreadsheet
gspread Talks to Google Sheets API using Python
oauth2client Manages Google authentication via a service account

🛠️ Setup

1. GitLab Access Token

  • Visit GitLab → Access Tokens
  • Create a token with the following scopes:
    • read_api
    • read_repository
  • Add it to your script:
    GITLAB_TOKEN = "your_personal_access_token"

2. Google Sheets API Credentials

  1. Go to Google Cloud Console
  2. Enable:
    • Google Sheets API
    • Google Drive API
  3. Create a Service Account:
    • Go to IAM & Admin → Service Accounts
    • Create one, and download the JSON key file
  4. Save the file as credentials.json in the same directory as your script

3. Grant Access to Your Google Sheet

  • Open your Google Sheet
  • Click Share
  • Add the client email from credentials.json (e.g. [email protected])
  • Set permission to Editor

4. Define Sheet Info in Script

SHEET_ID = "your_google_sheet_id_here"
SHEET_NAME = "Sheet1"  # or your tab name

To find the Sheet ID, grab it from the URL:

https://docs.google.com/spreadsheets/d/<< THIS IS YOUR ID >>/edit#gid=0

▶️ How to Run

Run the script with:

python collect_mrs.py

If everything is set up correctly, you’ll see:

✅ Google Sheet updated!

✅ What the Script Does

  • Authenticates with GitLab and Google Sheets
  • Pulls open MRs from the main branch
  • Categorizes MRs by type ([Bug], [Task], [Story])
  • Updates the specified tab in your Google Sheet with:
    • Project name
    • MR title
    • URL
    • Assignee
    • Type

📌 Author Kevin Pham Mobile Engineer · Organic Enthusiast · Automation Lover

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages