gitgithubtestingworkflowact

nektos/act: gh: command not found


I use 'nektos/act' for testing my GitHub Actions locally. It works correctly when I use curl request inside yaml script. For example:

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 }})

It gives me info about some pull request. But I should to exchange this curl request to CLI request, like this

pull_info=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json title,number,state)

I want to test it also, but act show me, that

/var/run/act/workflow/0: line 4: gh: command not found

I try to solve it. I found out that should to install gh-act extension using this command

gh extension install nektos/gh-act

But it still also doesn't work. How can I fix it? Or may be it can be test another ways?


Solution

  • You just should to use the large docker image of act