-
Notifications
You must be signed in to change notification settings - Fork 95
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
Provide env var to use gh CLI in GHA #3588
Conversation
.github/workflows/preview.yml
Outdated
env: | ||
GH_TOKEN: ${{ github.token }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a security point of view I wonder if we should set this at the top level or not. I'd lean to being as specific as possible. @evgeni any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'd mean adding it to every run
that has gh
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we somehow use CODEOWNERS to prevent changes from non-maintainers in .github/*
in PRs?
Applied in c4ffa1a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-maintainers can't merge, so I think that's fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. But still a nice angle: PRs that change/introduce GHA that run on PRs and use that token. I can only hope it's similar to GitLab and tied to your user account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'd mean adding it to every
run
that hasgh
?
More that any npm package we happen to pull in via surge
also can access the env var.
Original error message: Run gh run download '' -n pr gh run download '' -n pr shell: /usr/bin/bash -e {0} gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example: env: GH_TOKEN: ${{ github.token }} Refs 71b5724 (PR 3587 on GitHub)
1c07727
to
c4ffa1a
Compare
We are one step further: https://github.com/theforeman/foreman-documentation/actions/runs/12830400048/job/35778499772
|
Ooooh, |
What changes are you introducing?
Provide env vars to use
gh
in GHAWhy are you introducing these changes? (Explanation, links to references, issues, etc.)
Original error message:
Anything else to add? (Considerations, potential downsides, alternative solutions you have explored, etc.)
Refs 71b5724 (PR 3587 on GitHub)
Checklists
no cherry-picks.