Is there an easy way to export a list of Projects showing their last commit date?

365 Views Asked by At

I'm in the process of moving our internal GitLab server to Azure ADO repos and I've been tasked with exporting a list of projects with their last commit date so we can see what is useful and what we need to export.

For some reason, Git decided not to have a simple button for this, I have attempted to do this myself with a curl command which echos into a text file but I dont think I've got everything. Does anyone else have any suggestions?

1

There are 1 best solutions below

0
Jeanot Zubler On

GitLab has a Project API where you can access a list of projects.

https://gitlab.example.com/api/v4/projects

This shows you a list of 20 projects. To show more (up to 100) you can use:

https://git.gm-elektronik.ch/api/v4/projects?per_page=100

If you have more than 100 projects you have to append the page number:

https://git.gm-elektronik.ch/api/v4/projects?per_page=100&page=2

Each project entry has a property "last_activity_at". I don't think you can specifically get the latest commit, without going through the projects one by one. If this is necessary, I suggest looking at the Events API.