-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(ci): auto-create github releases and add workflow permissions #3009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile OverviewGreptile SummaryThis PR automates GitHub release creation when version commits (e.g., Key changes:
Implementation details:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Git as Git (main branch)
participant CI as CI Workflow
participant Build as Build Jobs
participant Release as create-release Job
participant GitHub as GitHub API
Dev->>Git: Push version commit (e.g., "v0.5.35: new feature")
Git->>CI: Trigger CI workflow
CI->>CI: detect-version job extracts version from commit
CI->>Build: test-build runs tests
Build->>Build: build-amd64 creates AMD64 images
Build->>Build: build-ghcr-arm64 creates ARM64 images
Build->>Build: create-ghcr-manifests creates multi-arch manifests
Build->>Release: Trigger after manifests complete
Release->>Release: Checkout code with full history
Release->>Release: Install dependencies (bun install)
Release->>GitHub: Check if release already exists (getReleaseByTag)
alt Release already exists
GitHub->>Release: 200 OK (release exists)
Release->>Release: Skip creation (idempotent)
else Release doesn't exist
GitHub->>Release: 404 Not Found
Release->>Release: Generate release notes from commits
Release->>GitHub: Create release (createRelease)
GitHub->>Release: Release created successfully
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: .github/workflows/ci.yml
Line: 376:385
Comment:
If a release already exists for this version, the GitHub API will return a 422 error and fail the workflow. Check if release exists first or handle the error gracefully
```suggestion
await octokit.rest.repos.createRelease({
owner: REPO_OWNER,
repo: REPO_NAME,
tag_name: targetVersion,
name: targetVersion,
body: releaseBody,
draft: false,
prerelease: false,
target_commitish: versionCommit.hash,
}).catch((error) => {
if (error.status === 422) {
console.log(`ℹ️ Release ${targetVersion} already exists, skipping creation`)
return
}
throw error
})
```
How can I resolve this? If you propose a fix, please make it concise. |
|
@greptile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
Summary
bun releasestep neededType of Change
Testing
Tested by reviewing workflow logic
Checklist