Skip to content

Commit adaedbc

Browse files
authored
Merge pull request #90 from github/workflow-permissions
Address security concerns with workflows
2 parents acea5bc + 07858f6 commit adaedbc

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.github/workflows/fetch-licenses.yaml

+7-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ on:
1313
jobs:
1414
fetch-licenses:
1515
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
1619

1720
steps:
1821
- name: Setup Git
1922
run: |
2023
git config --global user.name "GitHub Actions"
2124
git config --global user.email "github-actions[bot]@users.noreply.github.com"
22-
25+
2326
- name: Checkout this repository
2427
uses: actions/checkout@v4
2528

@@ -37,7 +40,7 @@ jobs:
3740
- name: Get date
3841
id: date
3942
run: echo "DT_STAMP"=$(date +'%Y-%m-%d %H:%M UTC') >> $GITHUB_ENV
40-
43+
4144
- name: Check for changes
4245
id: changes
4346
run: |
@@ -54,7 +57,7 @@ jobs:
5457
fi
5558
fi
5659
echo "HAS_CHANGES"=$has_changes >> $GITHUB_ENV
57-
60+
5861
- name: Run license extraction
5962
if: ${{ env.HAS_CHANGES == 'true' || github.event.inputs.force_run == 'true' }}
6063
run: |
@@ -66,7 +69,7 @@ jobs:
6669
6770
- name: Create Pull Request
6871
if: ${{ env.HAS_CHANGES == 'true' || github.event.inputs.force_run == 'true' }}
69-
uses: peter-evans/create-pull-request@v7
72+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
7073
with:
7174
token: ${{ secrets.GITHUB_TOKEN }}
7275
commit-message: Add updated license files

.github/workflows/lint.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [main]
66
pull_request: {}
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
build:
1013
strategy:
@@ -18,7 +21,7 @@ jobs:
1821
go-version: "1.18.5"
1922

2023
- name: golangci-lint
21-
uses: golangci/golangci-lint-action@v6.1.1
24+
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
2225
with:
2326
version: v1.47.3
2427
args: --verbose --config .golangci.yaml

.github/workflows/test.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [main]
66
pull_request: {}
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
test:
1013
strategy:

0 commit comments

Comments
 (0)