Skip to content

feat(discord/build): validate ref before dispatching workflow#152

Merged
barnabasbusa merged 2 commits intomasterfrom
worktree-build-validate-ref
Apr 21, 2026
Merged

feat(discord/build): validate ref before dispatching workflow#152
barnabasbusa merged 2 commits intomasterfrom
worktree-build-validate-ref

Conversation

@barnabasbusa
Copy link
Copy Markdown
Contributor

Summary

  • Probe GET /repos/{owner}/{repo}/commits/{ref} right after defaults are resolved and before the workflow is dispatched.
  • On 404/422 (ref definitively not found): the deferred ephemeral is edited to "Build not dispatched — ref `X` not found in `owner/repo`". No workflow run is created and no correlation ID is burned.
  • On transient probe failures (network, rate limit, unexpected status): log a warning and fall through to dispatch so we don't regress reliability on the happy path.
  • Validation uses the existing c.httpClient + token — no new dependencies. Capped at 5s so a hung probe can't starve the 15-minute deferred ack budget.

Motivation

Complements ethpandaops/eth-client-docker-image-builder#355 (which fails fast in the prepare job). Catching the same error one step earlier means the user sees the failure in their own ephemeral within ~100-300 ms — no workflow run queued, no click through to GitHub to figure out what went wrong.

Test plan

  • Run /build with a valid repo + branch → build dispatches as before.
  • Run /build with a typo'd branch (e.g. ref: does-not-exist) → ephemeral shows "Build not dispatched — ref `does-not-exist` not found in …" and no run appears on GitHub.
  • Run /build with a valid commit SHA → dispatches (commits endpoint resolves SHAs).
  • Run /build with a garbage SHA (e.g. deadbeefdeadbeef) → ephemeral not-found message.
  • Run /build with a nonexistent repository → ephemeral not-found message.
  • Omit ref so the workflow default kicks in → validation still runs against the default and passes.

Clicking "Copy tag"/"Copy tags" now returns an ephemeral reply with
each image tag in its own triple-backtick block, so Discord's per-block
copy icon copies a single tag — no more duplicated link+block and no
risk of grabbing every tag at once. The "Show another image…" dropdown
is removed since all tags are visible in the reply.
Probe GitHub's repos/{owner}/{repo}/commits/{ref} endpoint right after
defaults are resolved and before the workflow is dispatched. On 404/422
the ephemeral reply is edited to "Build not dispatched — ref X not
found in owner/repo" and no workflow run is created. Transient probe
failures (network, rate limit, unexpected status) are logged and fall
through to dispatch so we don't regress reliability on the happy path.
@barnabasbusa barnabasbusa requested a review from mattevans as a code owner April 21, 2026 08:17
@barnabasbusa barnabasbusa merged commit 43c7dad into master Apr 21, 2026
4 checks passed
@barnabasbusa barnabasbusa deleted the worktree-build-validate-ref branch April 21, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants