GitHub API-查找何时回购私有 [英] GitHub API - find when repo made private

查看:41
本文介绍了GitHub API-查找何时回购私有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个API,该API在我公司在GitHub上托管的存储库上运行报告.要求之一是列出何时将报告从公开的位置设为私有.我不确定API是否具有此功能.

首先,最重要的是,当我进入GitHub时,即使手动也无法找到此信息.因此,从设置"或其他部分中,有什么方法可以让我了解回购协议(我是其中的成员)是何时变为私有的?

解决方案

当仓库的可见性发生变化时,GitHub不提供信息.

他们的 API 仅显示回购是否为私有,是否相同适用于他们的常规网站.更改非常好,即使状态发生变化,它们甚至都无法跟踪.

但是,组织中的审核日志会跟踪访问更改.遗憾的是,它们的API中尚不提供此功能(还可以吗?),但是您可以在网站上将其导出为JSON或CSV,因此您可能假装成为用户并获取日志的JSON,然后在脚本中对其进行处理.>

更新:我刚刚检查过,在将回购公开和私有后,审计日志的导出版本是相同的.只有人类友好的文本版本(不是导出的一部分)提及它.因此,您需要检查回购的当前状态,以了解审核中的 repo.access 条目是公共对私有还是私有对公共.

I am creating an API which runs reports on repos that my company hosts on GitHub. One of the requirements is to list when reports were made private from public. I am not sure if the API has this feature.

Firstly and foremost, I was not able to find this information even manually when I went into GitHub. So from Settings or some other section, is there a way I can see when a repo (of which I am a member) was made private?

解决方案

GitHub doesn't provide information when the visibility of a repo changed.

Their API only shows whether a repo is private or not and the same applies to their regular website. Changes are good that they don't even track when the state changed.

However, the audit log in an organization keeps track of access changes. Unfortunately it is not available in their API (yet?), but you can export it as JSON or CSV on the website, so you could probably pretend to be a user and get the log's JSON and then process it in your script.

Update: I just checked and the exported versions of the audit log are identical when the repo is made public and private; only the human-friendly text version (not part of the export) mention it. So you'd need to check the current state of the repo to know whether the repo.access entry in the audit was public-to-private or private-to-public.

这篇关于GitHub API-查找何时回购私有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆