在Gitlab上获取tribution.json

如果在设置中关闭了“显示私人捐款”,如何在私人捐款的Gitlab CI管道中获得contributions.json我自己?

https://gitlab.com/users/GITLAB_USERNAME/calendar.json如果登录的用户是GITLAB_username,则同时显示公共贡献和私人贡献。

https://gitlab.com/users/GITLAB_USERNAME/calendar.json仅在登录用户不是GITLAB_username且GITLAB_username的“显示私人捐款”功能关闭时显示公共捐款。

我可以使用curl --cookie "_gitlab_session=..." https://gitlab.com/users/GITLAB_username/calendar.json来做到这一点,在CI_JOB_TOKEN中,我通过通过Web界面登录获得了cookie。默认情况下,会话Cookie会在1周后过期。

我希望通过CI管道自动执行此操作,而无需模拟登录并将密码存储为变量(不安全,并且如果更改密码,则需要更新所有密码)。

我尝试使用curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects"进行身份验证(就像我对API:href="#secondClick"所做的一样),但是仅显示公共捐款。

zhaozihong1 回答:在Gitlab上获取tribution.json

使用personal access token而不是工作令牌来访问gitlab api。

编辑: https://gitlab.com/users/GITLAB_USERNAME/calendar.json不是api url,而是gitlab端点,因此gitlab令牌无法使用。

您可以使用个人令牌和events API curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.com/api/v4/users/:id/events

收集所有事件

filter out,结果将根据您的需要使用参数。比从https://gitlab.com/users/GITLAB_USERNAME/calendar.json网址收集的数据要多得多,因此您需要对其进行处理。

本文链接:https://www.f2er.com/3169536.html

大家都在问