feat(github-actions): add versioned build-result marker to PR build comment#478
Open
3alpha wants to merge 1 commit into
Open
feat(github-actions): add versioned build-result marker to PR build comment#4783alpha wants to merge 1 commit into
3alpha wants to merge 1 commit into
Conversation
…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.
|
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.
Hash: (by dappnodebot/build-action) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.editedwebhooks.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_idis populated fromGITHUB_RUN_IDwhen non-empty.run_attemptis populated fromGITHUB_RUN_ATTEMPTonly when it parses as a positive integer.packages[].cidis normalized to a bare CID:/ipfs/<cid>andipfs://<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.Bug fix
Github.commentToPr()nowawaitscreateCommentInPr()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:/ipfs/andipfs://normalizationGITHUB_RUN_ID(omitted when missing/empty, present when set)GITHUB_RUN_ATTEMPT(positive integer accepted, zero/negative/non-numeric rejected)isTargetComment()accepts new marker, accepts legacy marker, rejects unrelated commentsrenderResultMarker/buildResultMarkerJsonJSON shape and single-line renderingtest/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 passingnpm run build→ cleannpx eslinton touched files → 0 errors (2 pre-existing warnings unchanged)git diff --check→ cleanThe 4 pre-existing failures in
test/commands/build.test.tsare 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.createdandissue_comment.edited(with the stable-marker filter) so re-runs of the workflow on the same PR are observed.