Compare commits

...

3 Commits

Author SHA1 Message Date
Connor Byrne
802ed44e53 fix: make upsert-comment-section conflict-tolerant across concurrent writers
Several workflows now share one PR comment via read-modify-write, which the
REST API can't do atomically. Re-read immediately before each write and verify
our section plus every previously-present section survived; on a detected
clobber, re-read and retry with backoff so concurrent writers converge instead
of dropping each other's sections.

Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/12939#discussion_r3432470450
2026-06-19 16:01:13 -07:00
Connor Byrne
13129d27cd feat: fold release summary into the unified PR report comment
Convert comment-release-links to upsert a release / desktop-release section
into the shared COMFYUI_FRONTEND_PR_REPORT comment instead of posting a
separate release-summary comment.
2026-06-17 18:28:27 -07:00
Connor Byrne
27efdc695e feat: fold website CI sections into the unified PR report comment
Point the website e2e, preview, and screenshot-update sections at the shared
COMFYUI_FRONTEND_PR_REPORT comment instead of the separate WEBSITE_CI_REPORT
comment, and add WEBSITE_CI_REPORT to the legacy-comment cleanup so the old
standalone website comment is removed.

Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/11935#pullrequestreview-4226267093
2026-06-17 18:25:54 -07:00
6 changed files with 85 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
name: Post Release Summary Comment
description: Post or update a PR comment summarizing release links with diff, derived versions, and optional extras.
description: Upsert a release-links section (diff, derived versions, optional extras) into the unified PR report comment.
author: ComfyUI Frontend Team
inputs:
@@ -49,7 +49,7 @@ runs:
exit 1
fi
MARKER='release-summary'
SECTION_NAME='release'
MESSAGE='Publish jobs finished successfully:'
LINKS_VALUE=''
@@ -60,7 +60,7 @@ runs:
'npm types|https://www.npmjs.com/package/@comfyorg/comfyui-frontend-types/v/{{version}}')
;;
apps/desktop-ui/package.json)
MARKER='desktop-release-summary'
SECTION_NAME='desktop-release'
LINKS_VALUE='npm desktop UI|https://www.npmjs.com/package/@comfyorg/desktop-ui/v/{{version}}'
;;
esac
@@ -71,7 +71,6 @@ runs:
COMMENT_FILE=$(mktemp)
{
echo "<!--$MARKER:$DIFF_PREFIX$NEW_VERSION-->"
echo "$MESSAGE"
echo ""
echo "- $DIFF_LABEL: [\`$DIFF_PREFIX$PREV_VERSION...$DIFF_PREFIX$NEW_VERSION\`]($DIFF_URL)"
@@ -99,21 +98,14 @@ runs:
echo "COMMENT_BODY_END_MARKER"
} >> "$GITHUB_OUTPUT"
echo "prev_version=$PREV_VERSION" >> "$GITHUB_OUTPUT"
echo "marker_search=<!--$MARKER:" >> "$GITHUB_OUTPUT"
echo "section_name=$SECTION_NAME" >> "$GITHUB_OUTPUT"
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
- name: Find existing comment
id: find
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
- name: Upsert release section into unified report
uses: ./.github/actions/upsert-comment-section
with:
issue-number: ${{ inputs.issue-number || github.event.pull_request.number }}
comment-author: github-actions[bot]
body-includes: ${{ steps.build.outputs.marker_search }}
- name: Post or update comment
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
issue-number: ${{ inputs.issue-number || github.event.pull_request.number }}
comment-id: ${{ steps.find.outputs.comment-id }}
body: ${{ steps.build.outputs.body }}
edit-mode: replace
pr-number: ${{ inputs.issue-number || github.event.pull_request.number }}
section-name: ${{ steps.build.outputs.section_name }}
section-content: ${{ steps.build.outputs.body }}
comment-marker: '<!-- COMFYUI_FRONTEND_PR_REPORT -->'
token: ${{ github.token }}

View File

@@ -49,36 +49,75 @@ runs:
// Escape special regex characters in delimiter strings
const escapeRegex = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const comments = await github.paginate(
github.rest.issues.listComments,
{ ...context.repo, issue_number: prNumber }
)
const existing = comments.find(
(c) =>
c.user?.login === 'github-actions[bot]' &&
c.body?.includes(commentMarker)
)
if (!existing) {
return github.rest.issues.createComment({
...context.repo,
issue_number: prNumber,
body: `${commentMarker}\n${sectionBlock}`
})
}
const body = existing.body ?? ''
const sectionRegex = new RegExp(
`${escapeRegex(sectionStart)}[\\s\\S]*?${escapeRegex(sectionEnd)}`
)
const updated = sectionRegex.test(body)
? body.replace(sectionRegex, sectionBlock)
: body.trimEnd() + '\n\n' + sectionBlock
return github.rest.issues.updateComment({
...context.repo,
comment_id: existing.id,
body: updated
})
// Every section-start marker in a body, used to detect whether a
// concurrent writer's section was lost across our write.
const sectionStartsIn = (body) =>
body.match(/<!-- section:[a-z0-9-]+:start -->/g) ?? []
const findComment = async () => {
const comments = await github.paginate(
github.rest.issues.listComments,
{ ...context.repo, issue_number: prNumber }
)
return comments.find(
(c) =>
c.user?.login === 'github-actions[bot]' &&
c.body?.includes(commentMarker)
)
}
// Several workflows share one comment via read-modify-write, which the
// REST API can't do atomically. Re-read immediately before each write
// and verify our section plus every previously-present section
// survived; on a detected clobber, re-read and retry so writers
// converge instead of silently dropping each other's sections.
const maxAttempts = 5
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
const existing = await findComment()
if (!existing) {
try {
await github.rest.issues.createComment({
...context.repo,
issue_number: prNumber,
body: `${commentMarker}\n${sectionBlock}`
})
return
} catch (err) {
if (attempt === maxAttempts) throw err
continue // another writer likely created it first; retry updates
}
}
const body = existing.body ?? ''
const expectedSections = sectionStartsIn(body)
const updated = sectionRegex.test(body)
? body.replace(sectionRegex, sectionBlock)
: body.trimEnd() + '\n\n' + sectionBlock
await github.rest.issues.updateComment({
...context.repo,
comment_id: existing.id,
body: updated
})
const current = (await findComment())?.body ?? ''
const survived =
current.includes(sectionBlock) &&
expectedSections.every((s) => current.includes(s))
if (survived) return
if (attempt === maxAttempts) {
core.warning(
`upsert-comment-section: section "${sectionName}" may have been clobbered by a concurrent writer after ${maxAttempts} attempts`
)
return
}
await new Promise((resolve) =>
setTimeout(resolve, 250 * attempt + Math.floor(Math.random() * 250))
)
}

View File

@@ -185,7 +185,7 @@ jobs:
with:
pr-number: ${{ github.event.pull_request.number }}
section-name: e2e
comment-marker: '<!-- WEBSITE_CI_REPORT -->'
comment-marker: '<!-- COMFYUI_FRONTEND_PR_REPORT -->'
token: ${{ secrets.GITHUB_TOKEN }}
section-content: |-
## 🌐 Website E2E
@@ -265,6 +265,6 @@ jobs:
with:
pr-number: ${{ github.event.pull_request.number }}
section-name: e2e
comment-marker: '<!-- WEBSITE_CI_REPORT -->'
comment-marker: '<!-- COMFYUI_FRONTEND_PR_REPORT -->'
token: ${{ secrets.GITHUB_TOKEN }}
section-content: ${{ steps.content.outputs.section-content }}

View File

@@ -142,6 +142,7 @@ jobs:
'<!-- COMFYUI_FRONTEND_PERF -->',
'<!-- PLAYWRIGHT_TEST_STATUS -->',
'<!-- STORYBOOK_BUILD_STATUS -->',
'<!-- WEBSITE_CI_REPORT -->',
];
const comments = await github.paginate(github.rest.issues.listComments, {

View File

@@ -179,7 +179,7 @@ jobs:
with:
pr-number: ${{ github.event.number || github.event.issue.number }}
section-name: screenshot-update
comment-marker: '<!-- WEBSITE_CI_REPORT -->'
comment-marker: '<!-- COMFYUI_FRONTEND_PR_REPORT -->'
token: ${{ secrets.GITHUB_TOKEN }}
section-content: |-
## 📸 Screenshot Update
@@ -240,6 +240,6 @@ jobs:
with:
pr-number: ${{ needs.update-screenshots.outputs.pr-number }}
section-name: screenshot-update
comment-marker: '<!-- WEBSITE_CI_REPORT -->'
comment-marker: '<!-- COMFYUI_FRONTEND_PR_REPORT -->'
token: ${{ secrets.GITHUB_TOKEN }}
section-content: ${{ steps.content.outputs.section-content }}

View File

@@ -58,7 +58,7 @@ jobs:
with:
pr-number: ${{ steps.pr-meta.outputs.number }}
section-name: preview
comment-marker: '<!-- WEBSITE_CI_REPORT -->'
comment-marker: '<!-- COMFYUI_FRONTEND_PR_REPORT -->'
token: ${{ secrets.GITHUB_TOKEN }}
section-content: |-
## 🔗 Website Preview