Skip to main content

Posts

Showing posts with the label CodeCommit

Python Script to list all open Pull requests from AWS CodeCommit repositories

The following Python script will help to export list of any open pull requests from CodeCommit repositories from an AWS account. The output will be saved within CSV file. #!/usr/bin/env python3.8 # This script is used to find out any open pull requests from all the repositories # from an account and write output to the csv file # Importing boto3, csv and time module import boto3 import csv import time # Setting up AWS profile and region profile = "default" region = "us-east-1" session = boto3 . Session ( profile_name = profile , region_name = region ) repo_client = session . client ( 'codecommit' ) repos = repo_client .list_repositories(     sortBy = 'repositoryName' ) repo_list = repos repo_name = repo_list [ 'repositories' ] # Getting current date and time date_time = time . strftime ( " %d %m%Y_%H%M%S" ) # Setting up file name fname = "Open_PullReqsIDs_" ftime = date_time fext = ".csv" filename