在Gitlab上获取contributions.json

在Gitlab上获取contributions.json,gitlab,gitlab-ci,gitlab-api,gitlab-ce,Gitlab,Gitlab Ci,Gitlab Api,Gitlab Ce,如果设置中的“show private contributions”(显示私人贡献)处于禁用状态,如何在Gitlab CI管道中使用私人贡献获取自己的contributions.json 如果登录用户是GITLAB_用户名,则显示公共和私人贡献 如果登录用户不是GITLAB_用户名,并且GITLAB_用户名的“显示私人贡献”处于禁用状态,则仅显示公共贡献 我可以使用curl--cookie“\u gitlab\u session=…”来实现这一点https://gitlab.com/users/

如果设置中的“show private contributions”(显示私人贡献)处于禁用状态,如何在Gitlab CI管道中使用私人贡献获取自己的
contributions.json

如果登录用户是GITLAB_用户名,则显示公共和私人贡献

如果登录用户不是GITLAB_用户名,并且GITLAB_用户名的“显示私人贡献”处于禁用状态,则仅显示公共贡献

我可以使用
curl--cookie“\u gitlab\u session=…”来实现这一点https://gitlab.com/users/GITLAB_USERNAME/calendar.json
在这里,我通过web界面登录获得了cookie。默认情况下,会话cookie在1周后过期

我想要一种通过CI管道自动执行此操作的方法,而无需模拟登录并将密码存储为变量(不安全,如果我更改密码,我需要更新所有密码)

我已经尝试使用
CI\u作业\u令牌
进行身份验证(就像我对API所做的那样:
curl--header“PRIVATE-TOKEN:$CI\u作业\u令牌”https://gitlab.com/api/v4/projects“
),但只显示公共贡献。

而不是使用作业令牌来访问gitlab api

编辑:
https://gitlab.com/users/GITLAB_USERNAME/calendar.json
不是api url,而是gitlab端点,因此gitlab令牌不适用于它

您可以使用个人令牌和api
curl--header“PRIVATE-token:”收集所有事件https://gitlab.com/api/v4/users/:id/events

要获得结果,请根据需要使用参数。从
https://gitlab.com/users/GITLAB_USERNAME/calendar.json
url,因此您需要对其进行处理。

而不是使用作业令牌来访问gitlab api

编辑:
https://gitlab.com/users/GITLAB_USERNAME/calendar.json
不是api url,而是gitlab端点,因此gitlab令牌不适用于它

您可以使用个人令牌和api
curl--header“PRIVATE-token:”收集所有事件https://gitlab.com/api/v4/users/:id/events


要获得结果,请根据需要使用参数。从
https://gitlab.com/users/GITLAB_USERNAME/calendar.json
url,所以您需要处理它。

我已经尝试了
curlhttps://gitlab.com/users/GITLAB_USERNAME/calendar.json?private_token=
curl——标题“私有令牌:” https://gitlab.com/users/GITLAB_USERNAME/calendar.json
。它们都只返回公共数据https://gitlab.com/users/GITLAB_USERNAME/calendar.json?private_token=和
curl——标题“私有令牌:”https://gitlab.com/users/GITLAB_USERNAME/calendar.json
。它们都只返回公共数据。