Commit graph

6 commits

Author SHA1 Message Date
Ryan Waskiewicz
6b18c2f260
test(release): add unit tests when searching for a release (#603)
* fix(release): break when draft release is found

when a release with the desired tag_name is found, break out of the loop
that looks for it. this prevents the case where accidentally overwrite a
detected release on successive iterations of the for loop

fixes: #602

* include built output

* add tests for finding tag from releases

add tests for updated functionality to break when we find a release.
the logic has been extracted into its own function, to make testing
simpler by avoiding over mocking/stubbing of network calls that would
create or update a release.

the tests that were added use jest's describe/it blocks, but use node's
assert function to align with other tests. there isn't any prior art for
mocking function calls in the codebase, so for now we use simple promises
in "mock" objects that adhere to the Releaser interface

* refactor findTagFromReleases

purely a sytlistic choice to not have to pre-declare the _release variable,
and not have to check using `typeof _release === "string"` when detecting
a found release

* reset dist/index.js to master

* update impl after merge with master

* update dist
2025-04-18 17:29:01 -04:00
WÁNG Xuěruì
deddb09c64
fix: big file uploads (#562)
* fix: use readableWebStream() to stream asset contents

This allows the uploads to finish without mismatched Content-Length,
likely because the original method implied a wrong body encoding or
something similar. Unfortunately a GitHub server API mock was not
readily available so I had to test manually with a barebones repository.

Fixes: #555
Fixes: #556
Signed-off-by: WANG Xuerui <git@xen0n.name>

* feat: log when each asset is successfully uploaded

Signed-off-by: WANG Xuerui <git@xen0n.name>

* build: refresh dist

Signed-off-by: WANG Xuerui <git@xen0n.name>

* style: format with prettier

Signed-off-by: WANG Xuerui <git@xen0n.name>

---------

Signed-off-by: WANG Xuerui <git@xen0n.name>
2025-01-07 13:42:55 -05:00
WÁNG Xuěruì
64f1fa19ef
feat: read the release assets asynchronously (#552)
Previously all assets were being read synchronously into memory, making
the action unsuitable for releasing very large assets. Because the
client library allows stream body inputs (it just forwards it to the
underlying `fetch` implementation), just do it.

The idea is also suggested by @enumag in
https://github.com/softprops/action-gh-release/issues/353#issuecomment-1793865790.

Fixes: #353

Signed-off-by: WANG Xuerui <git@xen0n.name>
2024-12-10 21:19:13 -05:00
Doug Tangren
003621c2ca
address asset upload warning (#134)
* bump version

* address asset upload warning

* refactor to new octokit api, work around release asset upload api

* format upload url

* unminify to debug

* try alt constructor

* utilize formatted upload url

* authorize upload

* pass token explicitly

* address conflicting uploads

* remove debugging artifacts
2021-08-08 00:28:01 -04:00
softprops
ef96a2eb52 prettier 2019-09-09 21:20:59 +09:00
softprops
18daf2c63f refactor for cross platform use 2019-09-09 17:10:07 +09:00