有没有办法在合并日期之前在github中找到PR?实际上是在日期范围内合并的PR。

没有找到任何东西,感觉很奇怪,所以请向社区询问。
谢谢

最佳答案

似乎没有一种使用PR GitHub API在PR上按日期,“merge_at”字段日期进行查询的方法。

您可以看到 file-suggest_backports-py-L333 (python)之类的脚本如何执行此操作,以便按日期获取和排序PR。

    # 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']

简而言之,您需要编写脚本:
  • 找到正确的分支(就像已经合并到master的分支一样,要么是因为它们被合并,要么是因为它们没有提交:请参阅“How can I know in git if a branch has been already merged into master?”)
  • 可以在本地存储库中和远程删除它们。参见“How to delete a Git branch both locally and remotely?
  • 关于Github按合并日期搜索PRS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40268278/

    10-13 07:16