Skip to content

Commit d73e5bf

Browse files
joseph-isaacsclaude
andcommitted
ci(bench): create the Polar Signals PR comment before profiled jobs start
polarsignals/gh-actions-ps-profiling finds its PR comment by a marker and creates one when none exists. Benchmark jobs that start profiling at the same time each saw no comment and created their own, leaving stale duplicates (two appeared on #10350 within a second). Create the marker comment once in the dispatch workflow, ahead of every label job whose benchmarks profile, so all jobs upsert the same comment. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ixWKUArMHQ19JTDMdggWV
1 parent c00354d commit d73e5bf

1 file changed

Lines changed: 57 additions & 8 deletions

File tree

‎.github/workflows/pr-bench-dispatch.yml‎

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,45 @@ permissions:
1919
id-token: write # enables AWS-GitHub OIDC
2020

2121
jobs:
22+
# polarsignals/gh-actions-ps-profiling upserts one PR comment found by its marker, but parallel
23+
# benchmark jobs that start profiling together each find none and create duplicates. Create it
24+
# once here, before any profiled benchmark job starts, so they all update the same comment.
25+
ensure-profiling-comment:
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 10
28+
if: >-
29+
github.event.pull_request.head.repo.fork == false && contains(fromJSON('[
30+
"action/bench-all",
31+
"action/bench-random-access",
32+
"action/bench-random-access-s3",
33+
"action/bench-compress",
34+
"action/bench-string",
35+
"action/bench-sql",
36+
"action/bench-sql-compact",
37+
"action/bench-sql-extended"
38+
]'), github.event.label.name)
39+
steps:
40+
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
41+
# Without the comment the action falls back to creating its own, so never block benchmarks.
42+
continue-on-error: true
43+
with:
44+
script: |
45+
const marker = "<!-- polar-signals-profiling-comment -->";
46+
const params = { ...context.repo, issue_number: context.payload.pull_request.number };
47+
const comments = await github.paginate(github.rest.issues.listComments, params);
48+
if (!comments.some((comment) => comment.body?.includes(marker))) {
49+
await github.rest.issues.createComment({
50+
...params,
51+
body: `${marker}\n## Polar Signals Profiling Results\n\nWaiting for profiled benchmark jobs to start.\n`,
52+
});
53+
}
54+
2255
remove-all-label:
56+
needs: ensure-profiling-comment
2357
runs-on: ubuntu-latest
2458
timeout-minutes: 10
25-
if: github.event.label.name == 'action/bench-all'
59+
if: >-
60+
!cancelled() && github.event.label.name == 'action/bench-all'
2661
steps:
2762
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
2863
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
@@ -58,9 +93,11 @@ jobs:
5893
matrix_preset: "pr-all"
5994

6095
remove-random-access-label:
96+
needs: ensure-profiling-comment
6197
runs-on: ubuntu-latest
6298
timeout-minutes: 10
63-
if: github.event.label.name == 'action/bench-random-access'
99+
if: >-
100+
!cancelled() && github.event.label.name == 'action/bench-random-access'
64101
steps:
65102
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
66103
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
@@ -74,9 +111,11 @@ jobs:
74111
secrets: inherit
75112

76113
remove-random-access-s3-label:
114+
needs: ensure-profiling-comment
77115
runs-on: ubuntu-latest
78116
timeout-minutes: 10
79-
if: github.event.label.name == 'action/bench-random-access-s3'
117+
if: >-
118+
!cancelled() && github.event.label.name == 'action/bench-random-access-s3'
80119
steps:
81120
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
82121
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
@@ -90,9 +129,11 @@ jobs:
90129
secrets: inherit
91130

92131
remove-compress-label:
132+
needs: ensure-profiling-comment
93133
runs-on: ubuntu-latest
94134
timeout-minutes: 10
95-
if: github.event.label.name == 'action/bench-compress'
135+
if: >-
136+
!cancelled() && github.event.label.name == 'action/bench-compress'
96137
steps:
97138
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
98139
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
@@ -106,9 +147,11 @@ jobs:
106147
secrets: inherit
107148

108149
remove-string-label:
150+
needs: ensure-profiling-comment
109151
runs-on: ubuntu-latest
110152
timeout-minutes: 10
111-
if: github.event.label.name == 'action/bench-string'
153+
if: >-
154+
!cancelled() && github.event.label.name == 'action/bench-string'
112155
steps:
113156
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
114157
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
@@ -138,9 +181,11 @@ jobs:
138181
secrets: inherit
139182

140183
remove-sql-label:
184+
needs: ensure-profiling-comment
141185
runs-on: ubuntu-latest
142186
timeout-minutes: 10
143-
if: github.event.label.name == 'action/bench-sql'
187+
if: >-
188+
!cancelled() && github.event.label.name == 'action/bench-sql'
144189
steps:
145190
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
146191
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
@@ -156,9 +201,11 @@ jobs:
156201
matrix_preset: "pr"
157202

158203
remove-sql-compact-label:
204+
needs: ensure-profiling-comment
159205
runs-on: ubuntu-latest
160206
timeout-minutes: 10
161-
if: github.event.label.name == 'action/bench-sql-compact'
207+
if: >-
208+
!cancelled() && github.event.label.name == 'action/bench-sql-compact'
162209
steps:
163210
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
164211
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
@@ -174,9 +221,11 @@ jobs:
174221
matrix_preset: "pr-compact"
175222

176223
remove-sql-extended-label:
224+
needs: ensure-profiling-comment
177225
runs-on: ubuntu-latest
178226
timeout-minutes: 10
179-
if: github.event.label.name == 'action/bench-sql-extended'
227+
if: >-
228+
!cancelled() && github.event.label.name == 'action/bench-sql-extended'
180229
steps:
181230
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
182231
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'

0 commit comments

Comments
 (0)