Skip to content

Commit 2309203

Browse files
authored
Grant minimum permissions to github acitons workflow jobs (#773)
## Changes Granting the minimum necessary permissions is always a good practice. There might be cases where permissions are insufficient, but since errors are very clear, I believe we can add them when a failure occurs. After merging, I will change the default of the GITHUB_ACTIONS token from read + write to read only. Then, I will run as many workflows as possible (including publish) to verify their operation. reference: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token#overview
1 parent 61d2491 commit 2309203

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

.github/workflows/auto-testing.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
1416
strategy:
1517
matrix:
1618
python-version:
@@ -44,6 +46,8 @@ jobs:
4446
4547
check-import:
4648
runs-on: ubuntu-latest
49+
permissions:
50+
contents: read
4751
strategy:
4852
matrix:
4953
python-version:

.github/workflows/check-eol-newrelease.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
jobs:
1010
check-eol-newrelease:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
issues: write
15+
if: github.repository == 'line/line-bot-sdk-python'
1216
steps:
1317
- name: Check out code
1418
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/close-issue.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
permissions:
1212
issues: write
1313
pull-requests: write
14+
if: github.repository == 'line/line-bot-sdk-python'
1415
steps:
1516
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
1617
with:

.github/workflows/create-draft-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ on:
2626
jobs:
2727
validate-input:
2828
runs-on: ubuntu-latest
29+
permissions: {}
2930
steps:
3031
- name: Validate Acknowledgement
3132
if: ${{ github.event.inputs.acknowledge_draft != 'Yes' }}
@@ -41,7 +42,8 @@ jobs:
4142
create-draft-release:
4243
runs-on: ubuntu-latest
4344
needs: validate-input
44-
45+
permissions:
46+
contents: write
4547
steps:
4648
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4749
- name: Fetch Latest Release

.github/workflows/generate-code.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ on:
1010
jobs:
1111
build:
1212
runs-on: ubuntu-latest
13-
13+
permissions:
14+
contents: write
15+
pull-requests: write
1416
steps:
1517
- name: Setup
1618
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

0 commit comments

Comments
 (0)