Skip to content

Commit f78d1f4

Browse files
authored
Grant minimum permissions to github acitons workflow jobs (#1577)
## 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 638c5f0 commit f78d1f4

7 files changed

+18
-2
lines changed

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

+4
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-java'
1216
steps:
1317
- name: Check out code
1418
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/close-issue.yml

+1
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-java'
1415
steps:
1516
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
1617
with:

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

+3-1
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

+3-1
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

.github/workflows/gradle.yml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
name: test (JDK ${{ matrix.java }})
2020
runs-on: ubuntu-latest
2121
timeout-minutes: 30
22+
permissions:
23+
contents: read
2224
strategy:
2325
fail-fast: false
2426
matrix:

.github/workflows/pom-validation.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ jobs:
55
name: test (JDK ${{ matrix.java }})
66
runs-on: ubuntu-latest
77
timeout-minutes: 10
8+
permissions:
9+
contents: read
810
strategy:
911
fail-fast: false
1012
matrix:

.github/workflows/publish.yml

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
jobs:
1313
publish:
1414
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
issues: write
1518
steps:
1619
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1720
with:

0 commit comments

Comments
 (0)