I am working on creating a CI/CD pipeline. Once files are committed to my bitbucket repo, I want to be able to
Hi @Saurabh Porwal,
Welcome to the Atlassian Community!
From the commits API, the results should also include a section with several links. Among those links, you have the option to grab the link for either the diff, or patch. The diff API should bring you the actual diff of that commit, allowing you to work out the files modified in this commit:
Curl -X GET "https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/diff/<commit>
In counterpart, the patch link should also contain a diff summary with all the files modified before showing the diff, so that could make it easier for you to parse the changes:
Curl -X GET "https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/patch/<commit>
Cheers,
Mateus T
Thanks @Mateus T both these APIs return the difference or patch and do have the file names but are in text format. I'm looking for an API response which could cleanly give me just filenames with path that have been updated preferably in JSON format so that is easier to parse and automate with any programming language.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gotcha! I definitely see how the JSON format would make that easier.
For now, those endpoints are the best way to get those files in a specific commit. I did find an open feature request in our public bug tracker which you can check through the following here.
Our development team will give a first-hand update through that ticket if there's any progress made so I would suggest keeping a watch for it. Please note that all enhancements are implemented with this policy in mind.
Cheers,
Mateus T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.