我正在从我的 Github 工作流程 (Action) 发送一条 cURL POST 请求来获取自托管 Runner 的注册令牌,但我收到了以下回复:
{
"message": "Resource not accessible by integration",
"documentation_url": "https://docs.github.com/rest/reference/actions#create-a-registration-token-for-a-repository"
}
以下是我 Github 工作流程的简化版本:
name: get-token
"on":
push: { branches: ["token"] }
jobs:
print-token:
name: print-token
environment: dev
# needs: pre-pkr
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get registration token
id: getRegToken
run: |
curl -X POST -H \"Accept: application/vnd.github.v3+json\" -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/myprofile/myrepo/actions/runners/registration-token
最终,我想将此令牌传递给使用packer build命令创建的ami(下一步)。 我还尝试了使用packer的shell provisioner进行上述curl请求,但是出现了相同的响应。 不知道是否需要从github ui允许某些权限?或者还有其他方法可以实现吗? 提前致谢。
workflow_dispatch
输入中的额外输入。 - andre