Skip to content

Commit 69b74f6

Browse files
Protect GitHub Actions secrets via local environment variables
1 parent 0bdff1b commit 69b74f6

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.github/workflows/Release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,6 @@ jobs:
5454
run: dotnet pack -c Release -p:ContinuousIntegrationBuild=true
5555

5656
- name: Push NuGet Package
57-
run: dotnet nuget push src/bin/Release/LoadTestToolbox.$(echo ${{ github.ref }} | sed 's/refs\/tags\///').nupkg -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json
57+
run: dotnet nuget push src/bin/Release/LoadTestToolbox.$(echo ${{ github.ref }} | sed 's/refs\/tags\///').nupkg -k $NUGET_TOKEN -s https://api.nuget.org/v3/index.json
58+
env:
59+
NUGET_TOKEN: ${{secrets.NUGET_TOKEN}}

.github/workflows/Sonar.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ jobs:
3030
run: dotnet restore
3131

3232
- name: Start Sonar Analysis
33-
run: dotnet-sonarscanner begin /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /o:"ecoapm" /k:"ecoAPM_LoadTestToolbox" /d:sonar.cs.vstest.reportsPaths="test/TestResults/results.trx" /d:sonar.cs.opencover.reportsPaths="test/TestResults/coverage.opencover.xml"
33+
run: dotnet-sonarscanner begin /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="$SONAR_TOKEN" /o:"ecoapm" /k:"ecoAPM_LoadTestToolbox" /d:sonar.cs.vstest.reportsPaths="test/TestResults/results.trx" /d:sonar.cs.opencover.reportsPaths="test/TestResults/coverage.opencover.xml"
34+
env:
35+
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
3436

3537
- name: Build
3638
run: dotnet build --no-restore
@@ -44,6 +46,7 @@ jobs:
4446
run: mv test/TestResults/**/*.xml test/TestResults
4547

4648
- name: Finish Sonar Analysis
47-
run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
49+
run: dotnet-sonarscanner end /d:sonar.login="$SONAR_TOKEN"
4850
env:
51+
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
4952
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)