我使用“nektos/act”在本地测试我的 GitHub 操作。当我在 yaml 脚本中使用curl 请求时,它可以正常工作。例如:
pull_info=$(curl -L -w "%{http_code}" \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
它为我提供了有关某些拉取请求的信息。但我应该将这个curl请求交换为CLI请求,就像这样
pull_info=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json title,number,state)
我也想测试一下,但请告诉我,那
/var/run/act/workflow/0: line 4: gh: command not found
我尝试解决它。我发现应该使用这个命令安装 gh-act 扩展
gh extension install nektos/gh-act
但它仍然不起作用。我该如何修复它?或者也许可以通过其他方式进行测试?
你应该使用 act 的大型 docker 镜像