Skip to content

Commit ade6efa

Browse files
Merge pull request #11064 from kikofernandez/kiko/otp/release-gh-action-backup-continuation/OTP-20040
otp: fixes permissions for reusable workflows OTP-20040
2 parents 302d02a + ce43bdc commit ade6efa

19 files changed

Lines changed: 112 additions & 8 deletions

.github/workflows/main.yaml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ permissions:
6060
jobs:
6161
check-files:
6262
if: github.event_name == 'pull_request'
63+
permissions:
64+
contents: read
6365
uses: ./.github/workflows/reusable-check-files.yaml
6466
with:
6567
pr_base_sha: ${{ github.event.pull_request.base.sha }}
@@ -75,9 +77,10 @@ jobs:
7577
pack:
7678
name: Build Erlang/OTP (64-bit)
7779
needs: setup
78-
uses: ./.github/workflows/reusable-pack.yaml
7980
permissions:
8081
contents: read
82+
actions: write
83+
uses: ./.github/workflows/reusable-pack.yaml
8184
with:
8285
base_branch: ${{ needs.setup.outputs.base_branch }}
8386
full_build_and_check: ${{ needs.setup.outputs.full_build_and_check }}
@@ -86,6 +89,9 @@ jobs:
8689
build-macos:
8790
name: Build Erlang/OTP (macOS)
8891
needs: pack
92+
permissions:
93+
contents: read
94+
actions: write
8995
if: needs.pack.outputs.build-c-code == 'true'
9096
uses: ./.github/workflows/reusable-build-macos.yaml
9197
with:
@@ -95,6 +101,9 @@ jobs:
95101
name: Build Erlang/OTP (iOS)
96102
needs: pack
97103
if: needs.pack.outputs.build-c-code == 'true'
104+
permissions:
105+
contents: read
106+
actions: write
98107
uses: ./.github/workflows/reusable-build-ios.yaml
99108
with:
100109
base_branch: ${{ needs.pack.outputs.base_branch }}
@@ -103,6 +112,9 @@ jobs:
103112
name: Build Erlang/OTP (Windows)
104113
needs: pack
105114
if: needs.pack.outputs.build-c-code == 'true'
115+
permissions:
116+
contents: read
117+
actions: write
106118
uses: ./.github/workflows/reusable-build-windows.yaml
107119
with:
108120
base_branch: ${{ needs.pack.outputs.base_branch }}
@@ -111,6 +123,8 @@ jobs:
111123
name: Build Erlang/OTP (Types and Flavors)
112124
needs: pack
113125
if: needs.pack.outputs.build-c-code == 'true'
126+
permissions:
127+
contents: read
114128
uses: ./.github/workflows/reusable-build-flavours.yaml
115129
with:
116130
base_branch: ${{ needs.pack.outputs.base_branch }}
@@ -121,8 +135,9 @@ jobs:
121135
needs: pack
122136
if: ${{ github.event_name == 'pull_request' && github.repository == 'erlang/otp'}}
123137
permissions:
124-
actions: read
125138
contents: read
139+
actions: write
140+
issues: write
126141
name: Vendor Vulnerability Scanning
127142
# This is an internal and trusted workflow.
128143
uses: ./.github/workflows/reusable-vendor-vulnerability-scanner.yml # zizmor: ignore[secrets-inherit]
@@ -140,6 +155,8 @@ jobs:
140155
name: Build Erlang/OTP
141156
needs: pack
142157
if: needs.pack.outputs.build-c-code == 'true'
158+
permissions:
159+
contents: read
143160
uses: ./.github/workflows/reusable-build-otp.yaml
144161
with:
145162
base_branch: ${{ needs.pack.outputs.base_branch }}
@@ -149,6 +166,7 @@ jobs:
149166
needs: pack
150167
permissions:
151168
contents: read
169+
actions: read
152170
if: needs.pack.outputs.build-c-code == 'true'
153171
uses: ./.github/workflows/reusable-freebsd.yaml
154172
with:
@@ -160,6 +178,7 @@ jobs:
160178
if: needs.pack.outputs.build-c-code == 'true'
161179
permissions:
162180
contents: read
181+
actions: read
163182
uses: ./.github/workflows/reusable-openbsd.yaml
164183
with:
165184
base_branch: ${{ needs.pack.outputs.base_branch }}
@@ -170,6 +189,7 @@ jobs:
170189
if: needs.pack.outputs.build-c-code == 'true' && false # Temporarily disable Solaris build as the VM image is currently broken
171190
permissions:
172191
contents: read
192+
actions: read
173193
uses: ./.github/workflows/reusable-solaris.yaml
174194
with:
175195
base_branch: ${{ needs.pack.outputs.base_branch }}
@@ -179,6 +199,9 @@ jobs:
179199
needs:
180200
- setup
181201
- pack
202+
permissions:
203+
contents: read
204+
actions: write
182205
uses: ./.github/workflows/reusable-documentation.yaml
183206
secrets:
184207
TRIGGER_ERLANG_ORG_BUILD: ${{ secrets.TRIGGER_ERLANG_ORG_BUILD }}
@@ -203,6 +226,9 @@ jobs:
203226
name: Test Erlang/OTP
204227
needs: pack
205228
if: needs.pack.outputs.changes != '[]'
229+
permissions:
230+
contents: read
231+
actions: write
206232
uses: ./.github/workflows/reusable-test.yaml
207233
with:
208234
changes: ${{ needs.pack.outputs.changes }}
@@ -211,6 +237,9 @@ jobs:
211237
system-test:
212238
name: Test Erlang/OTP (system)
213239
if: ${{ !cancelled() && needs.pack.result == 'success' }} # Run even if the need has failed
240+
permissions:
241+
contents: read
242+
actions: write
214243
needs:
215244
- pack
216245
- test
@@ -237,7 +266,7 @@ jobs:
237266
uses: ./.github/workflows/reusable-sbom.yaml
238267
permissions:
239268
contents: write
240-
actions: read
269+
actions: write
241270
packages: read
242271
id-token: write
243272
with:
@@ -257,6 +286,7 @@ jobs:
257286
contents: write
258287
attestations: write
259288
id-token: write
289+
actions: write
260290
if: startsWith(github.ref, 'refs/tags/OTP-') && github.repository == 'erlang/otp'
261291
uses: ./.github/workflows/reusable-release.yaml
262292
with:

.github/workflows/reusable-build-flavours.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
build-flavors:
4242
name: Build Erlang/OTP (Types and Flavors)
4343
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read # actions/checkout + ./.github/actions/build-base-image
4446
strategy:
4547
matrix:
4648
flavor: [jit, emu]

.github/workflows/reusable-build-ios.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ on:
2828
required: true
2929
type: string
3030

31+
permissions:
32+
contents: read
33+
3134
# NOTE: This job should only be executed on the callee with `needs: pack`
3235
jobs:
3336
build-ios:
@@ -36,6 +39,9 @@ jobs:
3639
TARGET_ARCH: aarch64-apple-ios
3740
name: Build Erlang/OTP (iOS)
3841
runs-on: macos-15
42+
permissions:
43+
contents: read # actions/checkout
44+
actions: write # actions/upload-artifact
3945
steps:
4046
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
4147
with:

.github/workflows/reusable-build-macos.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
build-macos:
3737
name: Build Erlang/OTP (macOS)
3838
runs-on: macos-15
39+
permissions:
40+
contents: read # actions/checkout + actions/cache (restore/save)
41+
actions: write # actions/download-artifact + actions/upload-artifact
3942
env:
4043
WXWIDGETS_VERSION: 3.2.9
4144
MACOS_VERSION: 15

.github/workflows/reusable-build-otp.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
build:
3636
name: Build Erlang/OTP
3737
runs-on: ubuntu-latest
38+
permissions:
39+
contents: read # actions/checkout + ./.github/actions/build-base-image
3840
strategy:
3941
matrix:
4042
type: [32-bit,cross-compile,clang]

.github/workflows/reusable-build-windows.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ on:
2828
required: true
2929
type: string
3030

31+
permissions:
32+
contents: read
33+
3134
# NOTE: This job should only be executed on the callee with `needs: pack`
3235
jobs:
3336
build-windows:
@@ -38,6 +41,9 @@ jobs:
3841
WXWIDGETS_VERSION: 3.2.6
3942
name: Build Erlang/OTP (Windows)
4043
runs-on: windows-2025
44+
permissions:
45+
contents: read # actions/cache (restore/save wxWidgets cache)
46+
actions: write # actions/download-artifact + actions/upload-artifact
4147
steps:
4248
- uses: Vampire/setup-wsl@6a8db447be7ed35f2f499c02c6e60ff77ef11278 # ratchet:Vampire/setup-wsl@v6.0.0
4349
with:

.github/workflows/reusable-check-files.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
check-files:
5353
name: Check modified files for errors
5454
runs-on: ubuntu-latest
55+
permissions:
56+
contents: read # actions/checkout (fetch-depth: 0) + git diff (whitespace + BEAM detection)
5557
steps:
5658
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
5759
with:

.github/workflows/reusable-documentation.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ on:
3939
TRIGGER_ERLANG_ORG_BUILD:
4040
required: true
4141

42+
permissions:
43+
contents: read
4244

4345
jobs:
4446
documentation:
4547
name: Build and check documentation
4648
runs-on: ubuntu-latest
49+
permissions:
50+
contents: read # actions/checkout + ./.github/actions/build-base-image
51+
actions: write # actions/upload-artifact
4752
steps:
4853
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
4954
with:

.github/workflows/reusable-freebsd.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
freebsd:
3737
name: Build Erlang/OTP (FreeBSD)
3838
runs-on: ubuntu-latest
39+
permissions:
40+
actions: read
3941
steps:
4042
- name: Download source archive
4143
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0

.github/workflows/reusable-openbsd.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
openbsd:
3737
name: Build Erlang/OTP (OpenBSD)
3838
runs-on: ubuntu-latest
39+
permissions:
40+
actions: read
3941
steps:
4042
- name: Download source archive
4143
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0

0 commit comments

Comments
 (0)