Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve workflow and resolver robustness
- Add comment documenting force-push destroys history
- Improve PR existence check to capture PR number
- Use git native version sorting instead of manual sort
- Keep semver validation on result for safety
  • Loading branch information
christian-byrne committed Nov 26, 2025
commit 48e03e835be587feb45677fb8e6ea3e495082fd2
7 changes: 5 additions & 2 deletions .github/workflows/weekly-comfyui-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ jobs:
fi

# Force push to fork (overwrites previous week's branch)
# Note: This intentionally destroys branch history to maintain a single PR
# Any review comments or manual commits will need to be re-applied
if ! git push -f origin "$BRANCH"; then
echo "Failed to push branch to fork"
exit 1
Expand All @@ -240,8 +242,9 @@ jobs:
--draft 2>&1; then

# Check if PR already exists
if gh pr list --repo comfyanonymous/ComfyUI --head "${FORK_OWNER}:${BRANCH}" --json number --jq '.[0].number' > /dev/null 2>&1; then
echo "PR already exists, updating branch will update the PR"
EXISTING_PR=$(gh pr list --repo comfyanonymous/ComfyUI --head "${FORK_OWNER}:${BRANCH}" --json number --jq '.[0].number' 2>/dev/null || echo "")
if [ -n "$EXISTING_PR" ]; then
echo "PR already exists (#${EXISTING_PR}), updating branch will update the PR"
else
echo "Failed to create PR and no existing PR found"
exit 1
Expand Down
34 changes: 10 additions & 24 deletions scripts/cicd/resolve-comfyui-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,26 @@ function getLatestPatchTag(repoPath: string, minor: number): string | null {
// Fetch all tags
exec('git fetch --tags', repoPath)

// List all tags matching v1.{minor}.*
const tags = exec(`git tag -l 'v1.${minor}.*'`, repoPath)
.split('\n')
.filter((tag) => tag.trim() !== '')
// Use git's native version sorting to get the latest tag
const latestTag = exec(
`git tag -l 'v1.${minor}.*' --sort=-version:refname | head -n 1`,
repoPath
)

if (tags.length === 0) {
if (!latestTag) {
return null
}

// Filter to only valid semver tags (vX.Y.Z format)
// Validate the tag is a valid semver (vX.Y.Z format)
const validTagRegex = /^v\d+\.\d+\.\d+$/
const validTags = tags.filter((tag) => validTagRegex.test(tag))

if (validTags.length === 0) {
if (!validTagRegex.test(latestTag)) {
console.error(
`No valid semver tags found for minor version ${minor}. Found: ${tags.join(', ')}`
`Latest tag for minor version ${minor} is not valid semver: ${latestTag}`
)
return null
}

// Sort tags by version (semantic sort)
const sortedTags = validTags.sort((a, b) => {
const aParts = a.replace('v', '').split('.').map(Number)
const bParts = b.replace('v', '').split('.').map(Number)

for (let i = 0; i < 3; i++) {
if (aParts[i] !== bParts[i]) {
return aParts[i] - bParts[i]
}
}
return 0
})

return sortedTags[sortedTags.length - 1]
return latestTag
}

/**
Expand Down