Skip to content

Commit 5cc0855

Browse files
committed
Merge pull request #4856 from arturcic/chore/github-actions-secret-cleanup
chore(build): reduce GitHub Actions secret usage
2 parents a315acb + f33b72f commit 5cc0855

6 files changed

Lines changed: 26 additions & 12 deletions

File tree

.github/workflows/_docker.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ env:
1818
DOTNET_INSTALL_DIR: "./.dotnet"
1919
DOTNET_ROLL_FORWARD: "Major"
2020

21+
permissions:
22+
packages: write
23+
2124
jobs:
2225
docker:
2326
name: ${{ matrix.docker_distro }} - net${{ matrix.dotnet_version }}
@@ -64,4 +67,4 @@ jobs:
6467
docker_registry_username: ${{ secrets.DOCKER_USERNAME }}
6568
docker_registry_password: ${{ secrets.DOCKER_PASSWORD }}
6669
github_registry_username: ${{ github.repository_owner }}
67-
github_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
70+
github_registry_password: ${{ github.token }}

.github/workflows/_docker_manifests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ env:
1212
DOTNET_INSTALL_DIR: "./.dotnet"
1313
DOTNET_ROLL_FORWARD: "Major"
1414

15+
permissions:
16+
packages: write
17+
1518
jobs:
1619
manifest:
1720
name: ${{ matrix.docker_distro }} - net${{ matrix.dotnet_version }}
@@ -43,4 +46,4 @@ jobs:
4346
docker_registry_username: ${{ secrets.DOCKER_USERNAME }}
4447
docker_registry_password: ${{ secrets.DOCKER_PASSWORD }}
4548
github_registry_username: ${{ github.repository_owner }}
46-
github_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
49+
github_registry_password: ${{ github.token }}

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ env:
3434
DOTNET_NOLOGO: 1
3535
TESTINGPLATFORM_TELEMETRY_OPTOUT: 1
3636

37-
ENABLED_DIAGNOSTICS: ${{ secrets.ENABLED_DIAGNOSTICS }}
37+
ENABLED_DIAGNOSTICS: ${{ vars.ENABLED_DIAGNOSTICS }}
3838

3939
permissions:
4040
id-token: write
@@ -122,8 +122,14 @@ jobs:
122122
name: Release
123123
needs: [ publish, docker_linux_manifests ]
124124
runs-on: windows-2025
125+
permissions:
126+
contents: write
127+
packages: write
128+
id-token: write
129+
attestations: write
130+
issues: write
125131
env:
126-
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
132+
GITHUB_TOKEN: ${{ github.token }}
127133
steps:
128134
-
129135
name: Checkout

.github/workflows/docs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,14 @@ jobs:
121121
reporter: ${{ steps.reporter.outputs.value }}
122122

123123
publish:
124+
if: github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch'
124125
name: Publish docs
125126
needs: [ validate ]
126127
runs-on: ubuntu-24.04
128+
permissions:
129+
contents: write
127130
env:
128-
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
131+
GITHUB_TOKEN: ${{ github.token }}
129132
GITHUB_USERNAME: ${{ github.actor }}
130133
steps:
131134
-

.github/workflows/mkdocs.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ defaults:
2929
run:
3030
shell: pwsh
3131

32+
permissions:
33+
contents: write
34+
3235
jobs:
3336
docs:
3437
name: Update Markdown (embedded snippets)
@@ -38,8 +41,6 @@ jobs:
3841
name: Checkout
3942
uses: actions/checkout@v6
4043
if: github.event_name == 'push'
41-
with:
42-
token: ${{ secrets.PUSH_GITHUB_TOKEN }}
4344
-
4445
name: Checkout
4546
uses: actions/checkout@v6
@@ -68,4 +69,4 @@ jobs:
6869
git config user.email 'gittoolsbot@outlook.com'
6970
git commit -m 'Docs changes' --allow-empty
7071
git push --force
71-
if: steps.status.outputs.has_changes == '1'
72+
if: steps.status.outputs.has_changes == '1' && github.event_name == 'push'

.github/workflows/public-api.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@ defaults:
1010
shell: pwsh
1111

1212
permissions:
13-
contents: read
13+
contents: write
1414

1515
jobs:
1616
homebrew:
1717
permissions:
18-
contents: none
18+
contents: write
1919
name: Mark public API as shipped
2020
runs-on: ubuntu-24.04
2121
steps:
2222
-
2323
name: Checkout
2424
uses: actions/checkout@v6
2525
if: github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch'
26-
with:
27-
token: ${{ secrets.PUSH_GITHUB_TOKEN }}
2826
-
2927
name: Mark public API as shipped
3028
run: ./src/mark-shipped.ps1

0 commit comments

Comments
 (0)