I have been searching Github documentation well as pygithub documentation as well on how I could get the stats for each users committed and merged lines of code into the master branch from a specific date. So far the best i could find is under contributions it list out a users committed lines of codes however this gives the stats for the life of the project but i need to filter this by a specific date. Is there anyway to do this appreciate the help.
It looks like you can pretty easily retrieve a list of the commits from a specific user and in agiven date range using the pygithub Repository get_commits method. You can see from the method signature below that you can filter by the hash, path, date range, and author.
def get_commits(
self,
sha=github.GithubObject.NotSet,
path=github.GithubObject.NotSet,
since=github.GithubObject.NotSet,
until=github.GithubObject.NotSet,
author=github.GithubObject.NotSet,
)
Related
I'm trying to query PRs in the Github GUI based on certain criterias. I want to show all pull requests that have not been written by a certain author.
The following example would be a query that returns all PRs written by the author mgol:
https://github.com/pulls?q=org%3Ajquery+is%3Aopen+is%3Apr+author%3Amgol
I would now like to return all PRs in the jquery organization, but not the ones from mgol. I tried multiple things, adding not: and things like this, but nothing seems to just filter out the PRs by this single author.
Try adding -author:mgol to get negated searches. This applies to other searches, too (Issues, etc.). See https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#exclude-certain-results for more.
I am writing Node API to extract data from Github repo.
While doing so, I find a need to count commit for a repo for each day along with date.
I have tried this github api doc
I don't want to do this in this way
https://developer.github.com/v3/repos/commits/
An alternative way of doing this can be is to follow this link down below , but this also do not provide date along with week.
weekly commit count
Any thought/suggestion/help would be appreciated.
Thanks
This might help you:
Git commit count a day
https://www.commandlinefu.com/commands/view/12099/number-of-commits-per-day-in-a-git-repository
Is there any way to find PRs in github by it's merge date? Actually the PRs that were merged in the range of the dates.
Didn't find any and it feels weird, so asking the community.
Thanks
There does not seem to be a way to query by date, by "merge_at" field date on a PR using the PR GitHub API.
You can see how a script like file-suggest_backports-py-L333 (python) does it in order to get and sort PR by date.
# Now get all PRs and filter by whether or not they belong to the
# milestone; requesting them all at once is still faster than
# requesting one at a time. This would also be easier if the API
# supported sorting on PR lists
for pr in self.iter_pull_requests(state='closed'):
if (pr['number'] not in milestone_issues or not pr['merged_at']):
continue
merge_commit = self.get_pull_request_merge_commit(pr['number'])
# Ignore commits that were merged before the last tag date
if merge_commit['commit']['committer']['date'] < last_tag_date:
continue
if not self.find_merged_commit(merge_commit,
since=last_tag_date):
yield pr, merge_commit['sha']
But in short, you need to script it:
find the right branches (like the one already merged into master, either because they were merged, or because they have no commit: see "How can I know in git if a branch has been already merged into master?")
delete them both in your local repo and remotely. See "How to delete a Git branch both locally and remotely?"
You can also use github website to do the search by merge time according to the docs: https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-when-a-pull-request-was-merged
You can filter pull requests based on when they were merged, using the merged qualifier.
This qualifier takes a date as its parameter. Date formatting must follow the ISO8601 standard, which is YYYY-MM-DD (year-month-day). You can also add optional time information THH:MM:SS+00:00 after the date, to search by the hour, minute, and second. That's T, followed by HH:MM:SS (hour-minutes-seconds), and a UTC offset (+00:00).
with an example as follows:
language:javascript merged:<2011-01-01 matches pull requests in JavaScript repositories that were merged before 2011.
I need to do a very large search on Github for a statistic in my thesis.
For example, I need to explore a large number of Android projects on GitHub, but the site limits the search result to 1000 (ex. https://github.com/search?l=java&q=onCreate&ref=searchresults&type=Code&utf8=%E2%9C%93). Also using the Java GitHub API I tried the library org.eclipse.egit.github.core.client.GitHubClient using the method GitHubClient.searchRepositories() but even there the number of results is limited.
Does anyone know how to get all results?
The Search API will return up to 1000 results per query (including pagination), as documented here:
https://developer.github.com/v3/search/#about-the-search-api
However, there's a neat trick you could use to fetch more than 1000 results when executing a repository search. You could split up your search into segments, by the date when the repositories were created. For example, you could first search for repositories that were created in the first week of October 2013, then second week, then September, and so on.
Because you would be restricting search to a narrow period, you will probably get less than 1000 results, and would therefore be able to get all of them. In case you notice that more than 1000 results are returned for a period, you would have to narrow the period even more, so that you can collect all results.
https://help.github.com/articles/searching-repositories/#search-based-on-when-a-repository-was-created-or-last-updated
You should be able to automate this via the API.
If you are searching for all files in Github with filename:your-file-name, you could also slice it with a query attribute : size.
For example, you are looking for all files named test.rb in Github, Github API may return more than 11M results, but you could only get 1000 of them because the GitHub Search API provides up to 1,000 results for each search. An url like : https://api.github.com/search/code?q=filename:test.rb+size:1000..1500 would be able to slice your search by changing size range.
I am not sure if this is possible - I would like to know which issues were in which state on certain date. I tried but did not find anything. Any help would be appreciated.
EDIT: To make it clear, I would like to see status of the project e.g. a week ago, such as:
PROJECT=A AND issueType=Bug ON 2015/04/04 //something like that
Yes you can !!
Jira has advanced search feature,where you can provide different query and you can also get all bugs for one or more projects at particular data.
For more details go through
To get bugs created,resolved or updated on particular date there are custom fields created at , resolved at and updated at and then you need pass date in yyyy-mm-dd format
[Reference] http://blogs.atlassian.com/2013/01/jql-the-most-flexible-way-to-search-jira-14/