Skip to content

Commit cc39ec5

Browse files
authored
Grant minimum permissions to github acitons workflow jobs (#406)
## 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 c2ce4fc commit cc39ec5

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

.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-ruby'
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-ruby'
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/pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
1113
strategy:
1214
matrix:
1315
# https://www.ruby-lang.org/en/downloads/branches/

0 commit comments

Comments
 (0)