Skip to content

Commit 6bec637

Browse files
authored
Merge pull request #4508 from k8s-infra-cherrypick-robot/cherry-pick-4502-to-release-1.13
[release-1.13] Set specific token permissions in GH actions
2 parents ef3ee9f + d9d7e38 commit 6bec637

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.github/workflows/dependabot-code-gen.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@ on:
99
- dependabot/**
1010
workflow_dispatch:
1111

12-
permissions:
13-
contents: write # Allow to update the PR.
12+
permissions: # added using https://github.com/step-security/secure-repo
13+
contents: read
1414

1515
jobs:
1616
build:
17+
permissions:
18+
contents: write # for EndBug/add-and-commit
1719
name: Build
1820
runs-on: ubuntu-latest
1921
steps:
2022
- name: Harden Runner
2123
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
2224
with:
2325
egress-policy: audit
24-
2526
- name: Set up Go 1.x
2627
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
2728
with:

.github/workflows/release.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ on:
77
paths:
88
- 'CHANGELOG/*.md'
99

10-
permissions:
11-
contents: write # Allow to push a tag, create a release branch and publish a draft release.
10+
permissions: # added using https://github.com/step-security/secure-repo
11+
contents: read
1212

1313
jobs:
1414
push_release_tag:
15+
permissions:
16+
pull-requests: read # for tj-actions/changed-files
17+
contents: write # for "Create Release Tag" step
1518
runs-on: ubuntu-latest
1619
outputs:
1720
release_tag: ${{ steps.release-version.outputs.release_version }}
@@ -20,7 +23,7 @@ jobs:
2023
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
2124
with:
2225
egress-policy: audit
23-
- name: Checkout code
26+
- name: Checkout code
2427
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
2528
with:
2629
fetch-depth: 0
@@ -80,6 +83,8 @@ jobs:
8083
git push origin ${RELEASE_VERSION}
8184
echo "Created tag $RELEASE_VERSION"
8285
release:
86+
permissions:
87+
contents: write # for softprops/action-gh-release to create GitHub release
8388
name: create draft release
8489
runs-on: ubuntu-latest
8590
needs: push_release_tag
@@ -116,4 +121,4 @@ jobs:
116121
draft: true
117122
files: out/*
118123
body_path: ${{ env.RELEASE_TAG }}.md
119-
tag_name: ${{ env.RELEASE_TAG }}
124+
tag_name: ${{ env.RELEASE_TAG }}

0 commit comments

Comments
 (0)