From dac15d39e49455d10257c7526c7ec603712ad5d3 Mon Sep 17 00:00:00 2001 From: A1lo <15844309+yin1999@users.noreply.github.com> Date: Sun, 21 Mar 2021 13:52:16 +0800 Subject: [PATCH 1/3] fix: Get the same behavior described in Docs(#71) (#85) Now trying read body path first then falling back on body --- __tests__/util.test.ts | 4 ++-- src/util.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/__tests__/util.test.ts b/__tests__/util.test.ts index 5a7a268..a2efd9e 100644 --- a/__tests__/util.test.ts +++ b/__tests__/util.test.ts @@ -58,9 +58,9 @@ describe("util", () => { }) ); }); - it("defaults to body when both body and body path are provided", () => { + it("defaults to body path when both body and body path are provided", () => { assert.equal( - "foo", + "bar", releaseBody({ github_ref: "", github_repository: "", diff --git a/src/util.ts b/src/util.ts index 6c1dce9..972b346 100644 --- a/src/util.ts +++ b/src/util.ts @@ -19,9 +19,9 @@ export interface Config { export const releaseBody = (config: Config): string | undefined => { return ( - config.input_body || (config.input_body_path && - readFileSync(config.input_body_path).toString("utf8")) + readFileSync(config.input_body_path).toString("utf8")) || + config.input_body ); }; From 94651eb27f706edbf0f2e9df85580cedf0f58dd1 Mon Sep 17 00:00:00 2001 From: David Aronchick Date: Sat, 20 Mar 2021 22:59:06 -0700 Subject: [PATCH 2/3] Update README.md (#81) --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fc1698a..5a85047 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ jobs: body_path: ${{ github.workflow }}-CHANGELOG.txt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: my_gh_org/my_gh_repo ``` ### ๐Ÿ’… Customizing @@ -181,7 +182,6 @@ The following are optional as `step.with` keys | `files` | String | Newline-delimited globs of paths to assets to upload for release | | `name` | String | Name of the release. defaults to tag name | | `tag_name` | String | Name of a tag. defaults to `github.ref` | -| `repository` | String | Name of a target repository in `/` format. defaults to the current repository | `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing| ๐Ÿ’กWhen providing a `body` and `body_path` at the same time, `body_path` will be attempted first, then falling back on `body` if the path can not be read from. @@ -202,6 +202,7 @@ The following are *required* as `step.env` keys | Name | Description | |----------------|--------------------------------------| | `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets`| +| `GITHUB_REPOSITORY` | Name of a target repository in `/` format. defaults to the current repository| > **โš ๏ธ Note:** This action was previously implemented as a Docker container, limiting its use to GitHub Actions Linux virtual environments only. With recent releases, we now support cross platform usage. You'll need to remove the `docker://` prefix in these versions From 1f8f474abe0de491760272aaae11d0b9bbc457a8 Mon Sep 17 00:00:00 2001 From: erri120 Date: Sun, 21 Mar 2021 06:59:32 +0100 Subject: [PATCH 3/3] Add upload_url as action output (#75) * Add upload_url as action output * Update README --- README.md | 1 + action.yml | 2 ++ src/main.ts | 1 + 3 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 5a85047..bf877bc 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,7 @@ The following outputs can be accessed via `${{ steps..outputs }}` from | Name | Type | Description | |-------------|---------|-----------------------------------------------------------------| | `url` | String | Github.com URL for the release | +| `upload_url`| String | URL for uploading assets to the release | #### environment variables diff --git a/action.yml b/action.yml index ab29e8a..dff78d6 100644 --- a/action.yml +++ b/action.yml @@ -35,6 +35,8 @@ env: outputs: url: description: 'URL to the Release HTML Page' + upload_url: + description: 'URL for uploading assets to the release' runs: using: 'node12' main: 'dist/index.js' diff --git a/src/main.ts b/src/main.ts index 47ae8b8..df7264e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -55,6 +55,7 @@ async function run() { } console.log(`๐ŸŽ‰ Release ready at ${rel.html_url}`); setOutput("url", rel.html_url); + setOutput("upload_url", rel.upload_url); } catch (error) { setFailed(error.message); }