Skip to content

Commit 957653d

Browse files
authored
Merge pull request #196 from filzrev/chore-benchmark-steps-to-rewrite-report-link
chore: Add benchmark steps to rewrite benchmar report URL of README.md
2 parents 8170f4d + 718cabe commit 957653d

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

.github/workflows/benchmark.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
jobs:
3030
benchmark:
3131
permissions:
32-
contents: read
32+
contents: write
3333
runs-on: ubuntu-24.04
3434
timeout-minutes: 360 # Default: 360 minutes
3535
steps:
@@ -67,9 +67,27 @@ jobs:
6767
$title = $title.Replace('_Double_', '<double>')
6868
6969
$content = Get-Content $item.FullName -Raw
70-
$tableContent = $content.Substring($content.IndexOf('|'))
70+
$tableContent = $content.Substring($content.IndexOf('|'))
7171
$tableContent.Replace('<', '&lt;').Replace('>', '&gt;')
7272
7373
Write-Output ('## {0}' -f $title) >> $env:GITHUB_STEP_SUMMARY
7474
Write-Output $tableContent >> $env:GITHUB_STEP_SUMMARY
7575
}
76+
77+
- name: Update README.md benchmark report link
78+
if: ${{ context.repo.owner == 'Cysharp' && github.ref_name == 'main' && inputs.config == 'Default' && inputs.filter == '*' }}
79+
shell: pwsh
80+
run: |
81+
$PSNativeCommandUseErrorActionPreference = $true
82+
83+
$md = Get-Content README.md -Raw
84+
$md = [regex]::Replace($md, 'https://github.com/Cysharp/ZLinq/actions/runs/([\d]+)',
85+
'https://github.com/Cysharp/ZLinq/actions/runs/${{ github.run_id }}')
86+
Set-Content -Path README.md -Value $md -Encoding utf8NoBOM
87+
88+
git config user.name "github-actions[bot]"
89+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
90+
91+
git add README.md
92+
git commit -m 'ci: update benchmark report link'
93+
git push

.github/workflows/build-debug.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- "main"
7+
paths-ignore:
8+
- README.md
79
pull_request:
810
branches:
911
- "main"

0 commit comments

Comments
 (0)