Skip to content

Commit f456839

Browse files
authored
Merge pull request #520 from crazy-max/gha-perms
ci: set contents read as default workflow permissions
2 parents 7df0ded + 16af861 commit f456839

File tree

4 files changed

+50
-17
lines changed

4 files changed

+50
-17
lines changed

.github/workflows/build.yml

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
name: build
22

3+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
4+
permissions:
5+
contents: read
6+
37
on:
48
pull_request:
59
branches:
610
- 'master'
711
push:
8-
branches: 'master'
12+
branches:
13+
- 'master'
914
tags:
1015
- '*.*.*'
1116

17+
env:
18+
VERSION: "0.0.0"
19+
1220
jobs:
1321
release:
1422
runs-on: windows-latest
23+
permissions:
24+
# required to create GitHub release
25+
contents: write
1526
steps:
1627
-
1728
name: Prepare
18-
id: prepare
1929
run: |
2030
if [[ $GITHUB_REF == refs/tags/* ]]; then
21-
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
22-
else
23-
echo ::set-output name=version::0.0.0
31+
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
2432
fi
2533
shell: bash
2634
-
@@ -45,13 +53,13 @@ jobs:
4553
version: latest
4654
args: chocoPack
4755
-
48-
name: Archive artifacts
49-
uses: actions/upload-artifact@v3
56+
name: Upload artifacts
57+
uses: actions/upload-artifact@v4
5058
with:
5159
name: WindowsSpyBlocker
5260
path: |
5361
bin/WindowsSpyBlocker.exe
54-
bin/windowsspyblocker.${{ steps.prepare.outputs.version }}.nupkg
62+
bin/windowsspyblocker.${{ env.VERSION }}.nupkg
5563
-
5664
name: GitHub Release
5765
uses: softprops/action-gh-release@v1
@@ -60,10 +68,8 @@ jobs:
6068
draft: true
6169
files: |
6270
bin/WindowsSpyBlocker.exe
63-
bin/windowsspyblocker.${{ steps.prepare.outputs.version }}.nupkg
64-
name: ${{ steps.prepare.outputs.version }}
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
bin/windowsspyblocker.${{ env.VERSION }}.nupkg
72+
name: ${{ env.VERSION }}
6773
-
6874
name: Mage chocoPush
6975
uses: magefile/mage-action@v2

.github/workflows/docs.yml

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: docs
22

3+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
4+
permissions:
5+
contents: read
6+
37
on:
48
workflow_dispatch:
59
push:
@@ -20,6 +24,9 @@ on:
2024
jobs:
2125
publish:
2226
runs-on: ubuntu-latest
27+
permissions:
28+
# required to push to gh-pages
29+
contents: write
2330
steps:
2431
-
2532
name: Checkout

.github/workflows/labels.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
11
name: labels
22

3+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
4+
permissions:
5+
contents: read
6+
37
on:
48
push:
59
branches:
610
- 'master'
711
paths:
812
- '.github/labels.yml'
913
- '.github/workflows/labels.yml'
14+
pull_request:
15+
paths:
16+
- '.github/labels.yml'
17+
- '.github/workflows/labels.yml'
1018

1119
jobs:
1220
labeler:
1321
runs-on: ubuntu-latest
22+
permissions:
23+
# same as global permissions
24+
contents: read
25+
# required to update labels
26+
issues: write
1427
steps:
1528
-
1629
name: Checkout
1730
uses: actions/checkout@v3
1831
-
1932
name: Run Labeler
20-
uses: crazy-max/ghaction-github-labeler@v4
33+
uses: crazy-max/ghaction-github-labeler@v5
34+
with:
35+
dry-run: ${{ github.event_name == 'pull_request' }}

.github/workflows/released.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: released
22

3+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
4+
permissions:
5+
contents: read
6+
37
on:
48
release:
59
types:
@@ -8,24 +12,25 @@ on:
812
jobs:
913
virustotal:
1014
runs-on: ubuntu-latest
15+
permissions:
16+
# required to write GitHub Release body
17+
contents: write
1118
steps:
1219
-
1320
name: VirusTotal Monitor Scan
14-
uses: crazy-max/ghaction-virustotal@v3
21+
uses: crazy-max/ghaction-virustotal@v4
1522
with:
1623
vt_api_key: ${{ secrets.VT_MONITOR_API_KEY }}
1724
vt_monitor: true
1825
monitor_path: /${{ github.event.repository.name }}/${{ github.event.release.tag_name }}
1926
update_release_body: false
20-
github_token: ${{ secrets.GITHUB_TOKEN }}
2127
files: |
2228
WindowsSpyBlocker.exe
2329
-
2430
name: VirusTotal Scan
25-
uses: crazy-max/ghaction-virustotal@v3
31+
uses: crazy-max/ghaction-virustotal@v4
2632
with:
2733
vt_api_key: ${{ secrets.VT_API_KEY }}
2834
update_release_body: true
29-
github_token: ${{ secrets.GITHUB_TOKEN }}
3035
files: |
3136
WindowsSpyBlocker.exe

0 commit comments

Comments
 (0)