Skip to content

feat(github-actions): add versioned build-result marker to PR build comment#478

Open
3alpha wants to merge 1 commit into
masterfrom
feat/build-result-marker-v1
Open

feat(github-actions): add versioned build-result marker to PR build comment#478
3alpha wants to merge 1 commit into
masterfrom
feat/build-result-marker-v1

Conversation

@3alpha

@3alpha 3alpha commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

Appends a stable identity marker and a structured, machine-readable completion marker to the build bot's PR comment so downstream services (e.g. TropiBot) can reliably parse build results from issue_comment.created / issue_comment.edited webhooks.

Marker contract

Stable comment marker (always emitted, last line of the comment):

<!-- dappnode-build-comment:v1 -->

Structured result marker (single line, emitted only when at least one package has a non-empty hash):

<!-- dappnode-build-result:v1 {"commit_sha":"<sha>","run_id":"<id>","run_attempt":<n>,"packages":[{"dnp_name":"<dnp>","cid":"<bare-cid>"}]} -->

run_id is populated from GITHUB_RUN_ID when non-empty. run_attempt is populated from GITHUB_RUN_ATTEMPT only when it parses as a positive integer. packages[].cid is normalized to a bare CID: /ipfs/<cid> and ipfs://<cid> are stripped.

Backward compatibility

  • isTargetComment() returns true for either the new stable marker or the legacy (by dappnodebot/build-action) signature. Existing comments are updated in place — no duplicates.
  • New comments emit the legacy signature during the migration window so the first re-build after deploy both replaces the legacy comment and seeds the new contract.
  • The human-readable commit SHA, development-version warning, package names, install links, hashes, and legacy signature are preserved.

Bug fix

  • Github.commentToPr() now awaits createCommentInPr() on the create path. Previously the SDK could exit before the comment was posted in the short-lived GitHub Actions process.

Tests

  • test/commands/githubActions/botComment.test.ts — 28 unit tests:
    • single-package structured marker
    • multiple-package marker
    • /ipfs/ and ipfs:// normalization
    • optional GITHUB_RUN_ID (omitted when missing/empty, present when set)
    • valid/invalid GITHUB_RUN_ATTEMPT (positive integer accepted, zero/negative/non-numeric rejected)
    • stable marker always present, result marker absent when no package has a hash
    • isTargetComment() accepts new marker, accepts legacy marker, rejects unrelated comments
    • renderResultMarker / buildResultMarkerJson JSON shape and single-line rendering
  • test/providers/github/Github.test.ts — 1 unit test asserting the create path is awaited.

Validation

  • node_modules/.bin/mocha test/commands/githubActions/botComment.test.ts test/providers/github/Github.test.ts → 29 passing
  • npm run build → clean
  • npx eslint on touched files → 0 errors (2 pre-existing warnings unchanged)
  • git diff --check → clean

The 4 pre-existing failures in test/commands/build.test.ts are Docker-dependent (docker buildx bake) and reproduce on the base commit; they are unrelated to this change.

Concern for TropiBot

Because the SDK edits an existing comment when one is found and otherwise creates one, TropiBot should subscribe to both issue_comment.created and issue_comment.edited (with the stable-marker filter) so re-runs of the workflow on the same PR are observed.

…omment

Append a stable <!-- dappnode-build-comment:v1 --> marker and a single-line
structured <!-- dappnode-build-result:v1 <JSON> --> marker to the build bot
comment, with bare-CID normalization for /ipfs/ and ipfs:// prefixes. The
legacy (by dappnodebot/build-action) signature is preserved so isTargetComment
recognizes existing comments and updates them in place. GITHUB_RUN_ID and
GITHUB_RUN_ATTEMPT are forwarded into the structured payload. commentToPr now
awaits the create path so the SDK process does not exit before the comment is
posted.
@3alpha 3alpha requested a review from a team as a code owner July 13, 2026 14:58
@github-actions

Copy link
Copy Markdown

Dappnode bot has built and pinned the built packages to an IPFS node, for commit: 99803a0

This is a development version and should only be installed for testing purposes.

  1. Package dappnodesdk.public.dappnode.eth

Install link

Hash: /ipfs/QmYbvncoYvCgswrspD46fab9BkwAEEdZup5UACAPJfRyGn

(by dappnodebot/build-action)

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.

1 participant