Skip to content

Commit 460447a

Browse files
authored
Add create-release! function to support GitHub releases (#38)
This function allows users to create a new release for a repository, including parameters for tag name, target commit, title, and draft status. Documentation for the function has been added for clarity.
1 parent 8c8e3c8 commit 460447a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/clj_github/repository.clj

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,26 @@
246246
:headers {"Accept" "application/vnd.github.v3+json"}
247247
:method :post
248248
:body body}))
249+
250+
(defn create-release!
251+
"Creates a new release for the repository.
252+
If the `tag_name` does not exist in the repository, GitHub will automatically create it.
253+
254+
Parameters:
255+
- owner: The account owner of the repository (string).
256+
- repo: The name of the repository (string).
257+
- body: A map of parameters for the release
258+
- :tag_name - The name of the tag (e.g., \"v1.0.0\")
259+
- :target_commitish - The branch or SHA the tag is created from
260+
- :name - The title of the release
261+
- :body - Text describing the contents of the tag
262+
- :draft - Boolean, true to create a draft (unpublished) release
263+
- :prerelease - Boolean, true to identify the release as a prerelease
264+
- :generate_release_notes - Boolean, automatically generate the title and body
265+
266+
For details about the parameters and response format, look at https://docs.github.com/en/rest/releases/releases#create-a-release"
267+
[client owner repo body]
268+
(fetch-body! client {:path (format "/repos/%s/%s/releases" owner repo)
269+
:headers {"Accept" "application/vnd.github.v3+json"}
270+
:method :post
271+
:body body}))

0 commit comments

Comments
 (0)