在试图通过ssh设置提交的构建状态时,我遇到了一些困难。我首先使用GitHub个人接入令牌成功地设置了构建状态。基于这个答案,我创建了以下curl命令:
#!/bin/bash
USER="red"
REPO="code"
COMMIT_SHA="6ec8d6ef221c3e317fa20b1f541770b8f46f065c"
MY_TOKEN="somelongpersonaltoken"
curl -H "Authorization: token $MY_TOKEN" --request POST --data '{"state": "failure", "description": "Failed!", "target_url": "https://www.stackoverflow.com"}' https://api.github.com/repos/$USER/$REPO/statuses/$COMMIT_SHA
它设置与下面的红十字类似的生成状态:
接下来,我使用以下方法检索了GitHub提交状态:
GET https://api.github.com/repos/$USER/$REPO/commits/$COMMIT_SHA/statuses
其中产出:
[{"url":"https://api.github.com/repos/... ,"state":"failure","description":"Failed!","target_url":"https://www.stackoverflow.com","context":"default","created_at":"2021-12-19T10:10:20Z","updated_at":"2021-12-19T10:10:20Z"...,"site_admin":false}}]
和预期的一样。
然后,在第二部分中,我尝试省略使用GitHub个人访问令牌,并使用ssh凭据来设置提交构建状态。然而,这个答案似乎认为这是不可能的。因此,我想问:
如何在Bash中使用ssh凭据设置GitHub提交构建状态?
https://stackoverflow.com/questions/70410456
复制相似问题