Skip to content

Commit affce20

Browse files
committed
Update dotnet.yml: refine permissions and coverage logic
1 parent 2171fb7 commit affce20

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ env:
66
DOTNET_ENVIRONMENT: github
77
ASPNETCORE_ENVIRONMENT: github
88
BUILD_PATH: "${{github.workspace}}/artifacts"
9-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
109

1110
on:
1211
push:
@@ -20,6 +19,9 @@ on:
2019
- master
2120
- develop
2221

22+
permissions:
23+
contents: read
24+
2325
jobs:
2426
build:
2527

@@ -46,9 +48,11 @@ jobs:
4648
run: dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings
4749

4850
- name: Report Coverage
49-
if: success()
51+
if: success() && github.event_name != 'pull_request'
5052
continue-on-error: true
5153
uses: coverallsapp/github-action@v2
54+
env:
55+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
5256
with:
5357
file: "${{github.workspace}}/test/*/TestResults/*/coverage.info"
5458
format: lcov
@@ -80,6 +84,10 @@ jobs:
8084
needs: build
8185
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
8286

87+
permissions:
88+
contents: read
89+
packages: write
90+
8391
steps:
8492
- name: Download Artifact
8593
uses: actions/download-artifact@v8

0 commit comments

Comments
 (0)