Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into default-token
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Mar 21, 2021
2 parents 7e3b173 + 1f8f474 commit 05d11c9
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
39 changes: 21 additions & 18 deletions README.md
Expand Up @@ -154,6 +154,8 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ github.workflow }}-CHANGELOG.txt
env:
GITHUB_REPOSITORY: my_gh_org/my_gh_repo
```

### 馃拝 Customizing
Expand All @@ -162,37 +164,38 @@ jobs:

The following are optional as `step.with` keys

| Name | Type | Description |
|---------------------------|---------|---------------------------------------------------------------------------------------------|
| `body` | String | Text communicating notable changes in this release |
| `body_path` | String | Path to load text communicating notable changes in this release |
| `draft` | Boolean | Indicator of whether or not this release is a draft |
| `prerelease` | Boolean | Indicator of whether or not is a prerelease |
| `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 `<owner>/<repo>` format. Defaults to the current repository. |
| `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing |
| `token` | String | Secret GitHub Personal Access Token. Defaults to `${{ github.token }}` |
| Name | Type | Description |
|---------------------------|---------|-----------------------------------------------------------------------|
| `body` | String | Text communicating notable changes in this release |
| `body_path` | String | Path to load text communicating notable changes in this release |
| `draft` | Boolean | Indicator of whether or not this release is a draft |
| `prerelease` | Boolean | Indicator of whether or not is a prerelease |
| `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` |
| `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing|
| `token` | String | Secret GitHub Personal Access Token. Defaults to `${{ github.token }}`|

馃挕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.

#### outputs

The following outputs can be accessed via `${{ steps.<step-id>.outputs }}` from this action

| Name | Type | Description |
|-------------|---------|--------------------------------|
| `url` | String | Github.com URL for the release |
| Name | Type | Description |
|-------------|---------|-----------------------------------------------------------------|
| `url` | String | Github.com URL for the release |
| `upload_url`| String | URL for uploading assets to the release |


#### environment variables

The following `step.env` keys are allowed as a fallback but deprecated in favor of using inputs.

| Name | Description |
|----------------|---------------------------------------|
| `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets` |
| Name | Description |
|----------------|------------------------------------------------------------------------------------------------|
| `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets` |
| `GITHUB_REPOSITORY` | Name of a target repository in `<owner>/<repo>` 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
Expand Down
4 changes: 2 additions & 2 deletions __tests__/util.test.ts
Expand Up @@ -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: "",
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Expand Up @@ -39,6 +39,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'
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Expand Up @@ -20,9 +20,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
);
};

Expand Down

0 comments on commit 05d11c9

Please sign in to comment.