Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github search PRS by merge date

Tags:

github

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

like image 383
me1111 Avatar asked Oct 26 '16 17:10

me1111


People also ask

How do I search for issues or pull requests in GitHub?

Tip: You can focus your cursor on the search bar above the issue or pull request list with a keyboard shortcut. For more information, see " Keyboard shortcuts ." To learn more about GitHub CLI, see " About GitHub CLI ." You can use the GitHub CLI to search for issues or pull requests.

How do I default to using PR titles for squash merge commits?

You can now default to using PR titles for all squash merge commit messages. Navigate to 'Settings' in your repository and scroll down to the Pull Requests section. Select Allow squash merging and then select Default to PR title for squash merge commits.

How do I find detailed information about a repository on GitHub?

To find detailed information about a repository on GitHub, you can filter, sort, and search issues and pull requests that are relevant to the repository. Tip: You can also filter issues or pull requests using the GitHub CLI. For more information, see " gh issue list " or " gh pr list " in the GitHub CLI documentation.

How much does it cost to join this conversation on GitHub?

Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment


1 Answers

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?"
like image 191
VonC Avatar answered Oct 18 '22 13:10

VonC