Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket:GET list of Repos that has modifications on specific branch between two dates

kiranvemulapalli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 22, 2019

we have requirement to find the list of repositories that have commits/updates on develop branch between two date ranges . 

we have around 1000 repos . planning to do the scheduled deployments for each repo(application) twice a week .

Ex: if i do the first build on monday and second on Thursday. i would like to know how many repos have commits on develop branch between monday and Thursday so that i can skip the build for that specific repo  if there is no changes/commits on develop branch btw monday and thursday . 

i tried using repos api 1.0 but unable to pass since attribute to check the commits . 

is there any api that can allow me to pass since . similar to git command below 

git log --since="1 day ago" -p

Thanks in Advance 

 

1 answer

1 accepted

0 votes
Answer accepted
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 24, 2019

Hello Venkatakiran and welcome to the Community!

Per the example you provided and the requirements you have, you should be able to use the REST API to access the data you need. I would suggest the following approach to find any activity since the last commit using these endpoints:

These should allow you to located the commits on a date and then locate any commits between the dates requests.

If you’re running into issues with the above, please let us know what the problem or error message is so we can assist.

Regards,
Stephen Sifers

kiranvemulapalli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 29, 2019

Hi Stephen , Thanks so much for your reply . yes , i have implemented in the same way as you described in your answer. 

i am trying to see if there is any bitbucket API that might help us to provide the info in one shot . i.e i expected since attribute to work on the 2nd API of retrieving commits.  

here is the Api's that i have used 

1. get all the projects associated with the bitbucket 

2. from the projects - get repos associated with the projects 

3. from the repo - get the latest commit that was done on Develop branch and compare with the todays date to know how old that commit is . 

 

please let me know if i can improve the above implementation in any means . 

 

appreciate your response . and apologies for the late reply :) 

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 5, 2019

Hello Venkatakiran,

The approach you use to access the APIs will be entirely up to the language you wish you use to script this and your requirements for now and in the future. What you have now seems solid to start and will allow you to build and add more complexity in the future if needed.

A neat idea for something like this would be to share you finished script out via Bitbucket so you can open source the script for others to use and iterate as needed.

We look forward to hearing how the process goes and seeing a final product you create.

Regards,
Stephen Sifers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events