-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add read-only token permissions to GitHub Action workflows #12718
Conversation
Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
Almost all workflows recreated with `make generate_ci_workflows`. Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
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.
Hello Pedro and thank you for your first contribution. This looks good to me. However, I'll apply your change to even more workflows in a subsequent commit.
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
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.
LGTM
@frouioui thanks for the additional changes! I can't believe I missed so many workflows! One question, though: why did you grant |
Hello @pnacht! It seems like we are using the auto-generated GitHub Token that Actions gives us. I think we are required to have the |
Merging this now, we can always modify |
Ah yes! I hadn't seen it called as
That Action doesn't specify anything, but similar actions only require jobs:
build:
permissions:
contents: write It's also worth mentioning that
Also, # TEMPORARY WHILE GITHUB FIXES THIS https://github.com/actions/virtual-environments/issues/3185
- name: Add the current IP address, long hostname and short hostname record to /etc/hosts file
run: |
echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
# DON'T FORGET TO REMOVE CODE ABOVE WHEN ISSUE IS ADRESSED! The linked issue has been fixed. |
Hey @pnacht, thanks for reporting this! Do you mind opening an issue for this matter and assign it to me? I will take a look, we don't want to rely on unmaintained actions :) |
I'll open a PR now to remove this unnecessary bit of code. |
Description
As described in the issue below, this PR adds read-only token permissions to all GitHub Action workflows, including their respective templates.
close_stale_pull_requests.yml
needspull_request: write
permissions, so those were granted at the job level, ensuring that any future jobs added to the workflow don't have that permission unnecessarily.Related Issue(s)
Fixes #12717
Checklist