Skip to content

Commit dde0d23

Browse files
Copilotxperiandri
andauthored
ci: tighten workflow permissions and resolve event file path
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/ae314b8b-9c8a-4f87-a8b0-b77c4bfa2cef Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent d6101d4 commit dde0d23

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/publish-test-results.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,24 @@ jobs:
3434
path: test-results
3535
pattern: test-results-*
3636

37+
- name: Resolve event file path
38+
id: event_file
39+
shell: pwsh
40+
run: |
41+
$eventFilePath =
42+
Get-ChildItem -Path artifacts -Filter event.json -Recurse |
43+
Select-Object -First 1 -ExpandProperty FullName
44+
45+
if ($null -eq $eventFilePath) {
46+
throw "event.json file was not found in downloaded artifacts"
47+
}
48+
49+
"path=$eventFilePath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
50+
3751
- name: Publish test results
3852
uses: EnricoMi/publish-unit-test-result-action@v2
3953
with:
4054
commit: ${{ github.event.workflow_run.head_sha }}
41-
event_file: artifacts/event.json
55+
event_file: ${{ steps.event_file.outputs.path }}
4256
event_name: ${{ github.event.workflow_run.event }}
4357
files: "test-results/**/*.trx"

.github/workflows/pull-request.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ env:
1414
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
1515
DOTNET_NOLOGO: true
1616

17+
permissions: {}
18+
1719
jobs:
1820
event_file:
1921
if: github.event_name == 'pull_request'
2022
name: Publish event file
2123
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
2226
steps:
2327
- name: Upload event file
2428
uses: actions/upload-artifact@v4
@@ -27,6 +31,8 @@ jobs:
2731
path: ${{ github.event_path }}
2832

2933
build:
34+
permissions:
35+
contents: read
3036

3137
strategy:
3238
fail-fast: false

0 commit comments

Comments
 (0)