Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: Install gh cli on self-hosted runner #2103

Merged

Conversation

stevenhorsman
Copy link
Member

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 uses gh based on the gh 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 .

@stevenhorsman stevenhorsman requested a review from a team as a code owner October 10, 2024 09:52
.github/workflows/azure-e2e-test.yml Outdated Show resolved Hide resolved
In confidential-containers#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 uses `gh` based on the
`gh help environment` doc that states:
GH_TOKEN: an authentication token for github.com API requests.
Setting this avoids being prompted to authenticate.

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

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
@@ -117,6 +121,8 @@ jobs:
# For debugging
ls ./target/release
popd
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really interesting that gh doesn't read from GITHUB_TOKEN. Never used that tool much so don't know for sure.

Copy link
Member

@wainersm wainersm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stevenhorsman !

@wainersm wainersm merged commit 0b7e7d9 into confidential-containers:main Oct 10, 2024
19 checks passed
@stevenhorsman stevenhorsman deleted the intall-gh-in-workflows branch November 28, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants