Get commit authors in a repository for specific file extension in last one year

Hi Team,

I have scenario to find out the commit authors for the last 1 year on the default branch - more specifically for python files(only files ending with .py) Is there any ways for this?

I am able to get the details from a git command for this usage. But cloning a large set of repos and iterating is not the ideal way.

git shortlog -sn --since=“366 days” – “*.py” | sort -f | uniq -i

I could only find a attribute for specifc path but not a specific file extension. Here is my api request.

curl https://gitlab.com/api/v4/projects/xxx/repository/commits?since=2022-11-11T20:10:10Z&per_page=100&page=1 | jq -r .[ ].author_name | sort -f | uniq -i

I found another api which gives me all files from a commit Commits API | GitLab . I thought of iterating through all diff files and getting the author name only if he/she contributed to .py file.

But this process seems to be expensive when compared to git cloning. Any thoughts on this?

One more question:

What is the use of “first_parent” attribute in Commits API | GitLab?

Any examples are much appreciated!