workflows: Install gh cli on self-hosted runner #2103
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #2077 I forgot about pull_request_target not testing workflows in PRs and that self-hosted runners wouldn't have the gh cli installed, so this attempts to fix the workflows and install gh cli first.
I also set
GH_TOKEN
env in the step that usesgh
based on thegh help environment
doc that states:GH_TOKEN: an authentication token for github.com API requests. Setting this avoids being prompted to authenticate.
Hopefully this is enough to get us back passing.
Note: I did find a few actions to do this, but they were only used by single digit projects, so I figured it would be safer to do it ourselves for now
Disclaimer: This assumes that
secrets.GITHUB_TOKEN
is created for self-hosted runners, which some guides hint is true, but I can't find concrete GitHub doc of this .