mirror of
				https://github.com/softprops/action-gh-release.git
				synced 2025-11-03 13:19:25 +00:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			v0.1.6
			...
			ncc-packag
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					e6a400341a | ||
| 
						 | 
					5733db0089 | ||
| 
						 | 
					7060560593 | ||
| 
						 | 
					7b2fd2c223 | ||
| 
						 | 
					e7bba17971 | ||
| 
						 | 
					03caddd29a | 
							
								
								
									
										54
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -1,61 +1,43 @@
 | 
			
		||||
## 0.1.6
 | 
			
		||||
 | 
			
		||||
This is a release catch up have a hiatus. Future releases will happen more frequently
 | 
			
		||||
 | 
			
		||||
- Add 'fail_on_unmatched_files' input, useful for catching cases were your `files` input does not actually match what you expect [#55](https://github.com/softprops/action-gh-release/pull/55)
 | 
			
		||||
- Add `repository` input, useful for creating a release in an external repository [#61](https://github.com/softprops/action-gh-release/pull/61)
 | 
			
		||||
- Add release `id` to outputs, useful for refering to release in workflow steps following the step that uses this action [#60](https://github.com/softprops/action-gh-release/pull/60)
 | 
			
		||||
- Add `upload_url` as action output, useful for managing uploads separately [#75](https://github.com/softprops/action-gh-release/pull/75)
 | 
			
		||||
- Support custom `target_commitish` value, useful to customize the default [#76](https://github.com/softprops/action-gh-release/pull/76)
 | 
			
		||||
- fix `body_path` input first then fall back on `body` input. this was the originally documented precedence but was implemened the the opposite order! [#85](https://github.com/softprops/action-gh-release/pull/85)
 | 
			
		||||
- Retain original release info if the keys are not set, useful for filling in blanks for a release you've already started separately [#109](https://github.com/softprops/action-gh-release/pull/109)
 | 
			
		||||
- Limit number of times github api request to create a release is retried, useful for avoiding eating up your rate limit and action minutes do to either an invalid token or other circumstance causing the api call to fail [#111](https://github.com/softprops/action-gh-release/pull/111)
 | 
			
		||||
 | 
			
		||||
## 0.1.5
 | 
			
		||||
 | 
			
		||||
- Added support for specifying tag name [#39](https://github.com/softprops/action-gh-release/pull/39)
 | 
			
		||||
 | 
			
		||||
## 0.1.4
 | 
			
		||||
 | 
			
		||||
- Added support for updating releases body [#36](https://github.com/softprops/action-gh-release/pull/36)
 | 
			
		||||
- Steps can now access the url of releases with the `url` output of this Action [#28](https://github.com/softprops/action-gh-release/pull/28)
 | 
			
		||||
- Added basic GitHub API retry support to manage API turbulance [#26](https://github.com/softprops/action-gh-release/pull/26)
 | 
			
		||||
* Steps can now access the url of releases with the `url` output of this Action [#28](https://github.com/softprops/action-gh-release/pull/28)
 | 
			
		||||
* Added basic GitHub API retry support to manage API turbulance [#26](https://github.com/softprops/action-gh-release/pull/26)
 | 
			
		||||
 | 
			
		||||
## 0.1.3
 | 
			
		||||
 | 
			
		||||
- Fixed where `with: body_path` was not being used in generated GitHub releases
 | 
			
		||||
* Fixed where `with: body_path` was not being used in generated GitHub releases
 | 
			
		||||
 | 
			
		||||
## 0.1.2
 | 
			
		||||
 | 
			
		||||
- Add support for merging draft releases [#16](https://github.com/softprops/action-gh-release/pull/16)
 | 
			
		||||
* Add support for merging draft releases [#16](https://github.com/softprops/action-gh-release/pull/16)
 | 
			
		||||
 | 
			
		||||
GitHub's api doesn't explicitly have a way of fetching a draft release by tag name which caused draft releases to appear as separate releases when used in a build matrix.
 | 
			
		||||
This is now fixed.
 | 
			
		||||
 | 
			
		||||
- Add support for newline-delimited asset list [#18](https://github.com/softprops/action-gh-release/pull/18)
 | 
			
		||||
* Add support for newline-delimited asset list [#18](https://github.com/softprops/action-gh-release/pull/18)
 | 
			
		||||
 | 
			
		||||
GitHub actions inputs don't inherently support lists of things and one might like to append a list of files to include in a release. Previously this was possible using a comma-delimited list of asset path patterns to upload. You can now provide these as a newline delimieted list for better readability
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: Release
 | 
			
		||||
  uses: softprops/action-gh-release@v1
 | 
			
		||||
  if: startsWith(github.ref, 'refs/tags/')
 | 
			
		||||
  with:
 | 
			
		||||
    files: |
 | 
			
		||||
      filea.txt
 | 
			
		||||
      fileb.txt
 | 
			
		||||
      filec.txt
 | 
			
		||||
  env:
 | 
			
		||||
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
  - name: Release
 | 
			
		||||
    uses: softprops/action-gh-release@v1
 | 
			
		||||
    if: startsWith(github.ref, 'refs/tags/')
 | 
			
		||||
    with:
 | 
			
		||||
      files: |
 | 
			
		||||
        filea.txt
 | 
			
		||||
        fileb.txt
 | 
			
		||||
        filec.txt
 | 
			
		||||
    env:
 | 
			
		||||
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
- Add support for prerelease annotated GitHub releases with the new input field `with.prerelease: true` [#19](https://github.com/softprops/action-gh-release/pull/19)
 | 
			
		||||
* Add support for prerelease annotated GitHub releases with the new input field `with.prerelease: true` [#19](https://github.com/softprops/action-gh-release/pull/19)
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
## 0.1.1
 | 
			
		||||
 | 
			
		||||
- Add support for publishing releases on all supported virtual hosts
 | 
			
		||||
* Add support for publishing releases on all supported virtual hosts
 | 
			
		||||
 | 
			
		||||
You'll need to remove `docker://` prefix and use the `@v1` action tag
 | 
			
		||||
 | 
			
		||||
@@ -63,4 +45,4 @@ You'll need to remove `docker://` prefix and use the `@v1` action tag
 | 
			
		||||
 | 
			
		||||
## 0.1.0
 | 
			
		||||
 | 
			
		||||
- Initial release
 | 
			
		||||
* Initial release
 | 
			
		||||
@@ -1,12 +1,12 @@
 | 
			
		||||
## bootstrapping
 | 
			
		||||
 | 
			
		||||
This a [JavaScript](https://help.github.com/en/articles/about-actions#types-of-actions) action but uses [TypeScript](https://www.typescriptlang.org/docs/home.html) to generate that JavaScript.
 | 
			
		||||
This a [JavaScript](https://help.github.com/en/articles/about-actions#types-of-actions)  action but uses [TypeScript](https://www.typescriptlang.org/docs/home.html) to generate that JavaScript.
 | 
			
		||||
 | 
			
		||||
You can bootstrap your environment with a modern version of npm and by running `npm i` at the root of this repo.
 | 
			
		||||
You can bootstrap your envrinment with a modern version of npm and by running `npm i` at the root of this repo.
 | 
			
		||||
 | 
			
		||||
## testing
 | 
			
		||||
 | 
			
		||||
Tests can be found under under `__tests__` directory and are runnable with the `npm t` command.
 | 
			
		||||
Tests can be found under under `__tests__` directory and are runnable with the `npm t` command
 | 
			
		||||
 | 
			
		||||
## source code
 | 
			
		||||
 | 
			
		||||
@@ -14,4 +14,5 @@ Source code can be found under the `src` directory. Running `npm run build` will
 | 
			
		||||
 | 
			
		||||
## formatting
 | 
			
		||||
 | 
			
		||||
A minimal attempt at keeping a consistent code style is can be applied by running `npm run fmt`.
 | 
			
		||||
A minimal attempt at keeping a consistent code style is can be applied by running `npm run fmt`
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										50
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								README.md
									
									
									
									
									
								
							@@ -7,7 +7,7 @@
 | 
			
		||||
</h1>
 | 
			
		||||
 | 
			
		||||
<p align="center">
 | 
			
		||||
   A GitHub Action for creating GitHub Releases on Linux, Windows, and macOS virtual environments
 | 
			
		||||
   A GitHub Action for creating GitHub Releases on Linux, Windows, and OSX virtual environments
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<div align="center">
 | 
			
		||||
@@ -29,7 +29,7 @@
 | 
			
		||||
 | 
			
		||||
Typically usage of this action involves adding a step to a build that
 | 
			
		||||
is gated pushes to git tags. You may find `step.if` field helpful in accomplishing this
 | 
			
		||||
as it maximizes the reuse value of your workflow for non-tag pushes.
 | 
			
		||||
as it maximizes the resuse value of your workflow for non-tag pushes.
 | 
			
		||||
 | 
			
		||||
Below is a simple example of `step.if` tag gating
 | 
			
		||||
 | 
			
		||||
@@ -43,7 +43,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
        uses: actions/checkout@v1
 | 
			
		||||
      - name: Release
 | 
			
		||||
        uses: softprops/action-gh-release@v1
 | 
			
		||||
        if: startsWith(github.ref, 'refs/tags/')
 | 
			
		||||
@@ -66,7 +66,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
        uses: actions/checkout@v1
 | 
			
		||||
      - name: Release
 | 
			
		||||
        uses: softprops/action-gh-release@v1
 | 
			
		||||
        env:
 | 
			
		||||
@@ -75,7 +75,7 @@ jobs:
 | 
			
		||||
 | 
			
		||||
### ⬆️ Uploading release assets
 | 
			
		||||
 | 
			
		||||
You can configure a number of options for your
 | 
			
		||||
You can can configure a number of options for your
 | 
			
		||||
GitHub release and all are optional.
 | 
			
		||||
 | 
			
		||||
A common case for GitHub releases is to upload your binary after its been validated and packaged.
 | 
			
		||||
@@ -94,7 +94,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
        uses: actions/checkout@v1
 | 
			
		||||
      - name: Build
 | 
			
		||||
        run: echo ${{ github.sha }} > Release.txt
 | 
			
		||||
      - name: Test
 | 
			
		||||
@@ -120,7 +120,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
        uses: actions/checkout@v1
 | 
			
		||||
      - name: Build
 | 
			
		||||
        run: echo ${{ github.sha }} > Release.txt
 | 
			
		||||
      - name: Test
 | 
			
		||||
@@ -154,7 +154,7 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
        uses: actions/checkout@v1
 | 
			
		||||
      - name: Generate Changelog
 | 
			
		||||
        run: echo "# Good things have arrived" > ${{ github.workflow }}-CHANGELOG.txt
 | 
			
		||||
      - name: Release
 | 
			
		||||
@@ -164,7 +164,6 @@ jobs:
 | 
			
		||||
          body_path: ${{ github.workflow }}-CHANGELOG.txt
 | 
			
		||||
        env:
 | 
			
		||||
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          GITHUB_REPOSITORY: my_gh_org/my_gh_repo
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 💅 Customizing
 | 
			
		||||
@@ -173,24 +172,16 @@ 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`                                                             |
 | 
			
		||||
| `fail_on_unmatched_files` | Boolean | Indicator of whether to fail if any of the `files` globs match nothing                              |
 | 
			
		||||
| `target_commitish`        | String  | Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. |
 | 
			
		||||
| 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                       |
 | 
			
		||||
 | 
			
		||||
💡 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.
 | 
			
		||||
 | 
			
		||||
💡 When the release info keys (such as `name`, `body`, `draft`, `prerelease`, etc.)
 | 
			
		||||
are not explicitly set and there is already an existing release for the tag, the
 | 
			
		||||
release will retain its original info.
 | 
			
		||||
💡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
 | 
			
		||||
 | 
			
		||||
@@ -199,8 +190,8 @@ The following outputs can be accessed via `${{ steps.<step-id>.outputs }}` from
 | 
			
		||||
| Name        | Type    | Description                                                     |
 | 
			
		||||
|-------------|---------|-----------------------------------------------------------------|
 | 
			
		||||
| `url`       | String  | Github.com URL for the release                                  |
 | 
			
		||||
| `id`        | String  | Release ID                                                      |
 | 
			
		||||
| `upload_url`| String  | URL for uploading assets to the release                         |
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#### environment variables
 | 
			
		||||
@@ -210,9 +201,8 @@ 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 `<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
 | 
			
		||||
> **⚠️ 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
 | 
			
		||||
 | 
			
		||||
Doug Tangren (softprops) 2019
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,7 @@ import {
 | 
			
		||||
  isTag,
 | 
			
		||||
  paths,
 | 
			
		||||
  parseConfig,
 | 
			
		||||
  parseInputFiles,
 | 
			
		||||
  unmatchedPatterns
 | 
			
		||||
  parseInputFiles
 | 
			
		||||
} from "../src/util";
 | 
			
		||||
import * as assert from "assert";
 | 
			
		||||
 | 
			
		||||
@@ -36,9 +35,7 @@ describe("util", () => {
 | 
			
		||||
          input_draft: false,
 | 
			
		||||
          input_prerelease: false,
 | 
			
		||||
          input_files: [],
 | 
			
		||||
          input_name: undefined,
 | 
			
		||||
          input_tag_name: undefined,
 | 
			
		||||
          input_target_commitish: undefined
 | 
			
		||||
          input_name: undefined
 | 
			
		||||
        })
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
@@ -54,15 +51,13 @@ describe("util", () => {
 | 
			
		||||
          input_draft: false,
 | 
			
		||||
          input_prerelease: false,
 | 
			
		||||
          input_files: [],
 | 
			
		||||
          input_name: undefined,
 | 
			
		||||
          input_tag_name: undefined,
 | 
			
		||||
          input_target_commitish: undefined
 | 
			
		||||
          input_name: undefined
 | 
			
		||||
        })
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
    it("defaults to body path when both body and body path are provided", () => {
 | 
			
		||||
    it("defaults to body when both body and body path are provided", () => {
 | 
			
		||||
      assert.equal(
 | 
			
		||||
        "bar",
 | 
			
		||||
        "foo",
 | 
			
		||||
        releaseBody({
 | 
			
		||||
          github_ref: "",
 | 
			
		||||
          github_repository: "",
 | 
			
		||||
@@ -72,9 +67,7 @@ describe("util", () => {
 | 
			
		||||
          input_draft: false,
 | 
			
		||||
          input_prerelease: false,
 | 
			
		||||
          input_files: [],
 | 
			
		||||
          input_name: undefined,
 | 
			
		||||
          input_tag_name: undefined,
 | 
			
		||||
          input_target_commitish: undefined
 | 
			
		||||
          input_name: undefined
 | 
			
		||||
        })
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
@@ -87,61 +80,13 @@ describe("util", () => {
 | 
			
		||||
        github_token: "",
 | 
			
		||||
        input_body: undefined,
 | 
			
		||||
        input_body_path: undefined,
 | 
			
		||||
        input_draft: undefined,
 | 
			
		||||
        input_prerelease: undefined,
 | 
			
		||||
        input_draft: false,
 | 
			
		||||
        input_prerelease: false,
 | 
			
		||||
        input_files: [],
 | 
			
		||||
        input_name: undefined,
 | 
			
		||||
        input_tag_name: undefined,
 | 
			
		||||
        input_fail_on_unmatched_files: false,
 | 
			
		||||
        input_target_commitish: undefined
 | 
			
		||||
        input_name: undefined
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
  describe("parseConfig", () => {
 | 
			
		||||
    it("parses basic config with commitish", () => {
 | 
			
		||||
      assert.deepStrictEqual(
 | 
			
		||||
        parseConfig({
 | 
			
		||||
          INPUT_TARGET_COMMITISH: "affa18ef97bc9db20076945705aba8c516139abd"
 | 
			
		||||
        }),
 | 
			
		||||
        {
 | 
			
		||||
          github_ref: "",
 | 
			
		||||
          github_repository: "",
 | 
			
		||||
          github_token: "",
 | 
			
		||||
          input_body: undefined,
 | 
			
		||||
          input_body_path: undefined,
 | 
			
		||||
          input_draft: undefined,
 | 
			
		||||
          input_prerelease: undefined,
 | 
			
		||||
          input_files: [],
 | 
			
		||||
          input_name: undefined,
 | 
			
		||||
          input_tag_name: undefined,
 | 
			
		||||
          input_fail_on_unmatched_files: false,
 | 
			
		||||
          input_target_commitish: "affa18ef97bc9db20076945705aba8c516139abd"
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
    it("parses basic config with draft and prerelease", () => {
 | 
			
		||||
      assert.deepStrictEqual(
 | 
			
		||||
        parseConfig({
 | 
			
		||||
          INPUT_DRAFT: "false",
 | 
			
		||||
          INPUT_PRERELEASE: "true"
 | 
			
		||||
        }),
 | 
			
		||||
        {
 | 
			
		||||
          github_ref: "",
 | 
			
		||||
          github_repository: "",
 | 
			
		||||
          github_token: "",
 | 
			
		||||
          input_body: undefined,
 | 
			
		||||
          input_body_path: undefined,
 | 
			
		||||
          input_draft: false,
 | 
			
		||||
          input_prerelease: true,
 | 
			
		||||
          input_files: [],
 | 
			
		||||
          input_name: undefined,
 | 
			
		||||
          input_tag_name: undefined,
 | 
			
		||||
          input_fail_on_unmatched_files: false,
 | 
			
		||||
          input_target_commitish: undefined
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
  describe("isTag", () => {
 | 
			
		||||
    it("returns true for tags", async () => {
 | 
			
		||||
      assert.equal(isTag("refs/tags/foo"), true);
 | 
			
		||||
@@ -153,19 +98,9 @@ describe("util", () => {
 | 
			
		||||
 | 
			
		||||
  describe("paths", () => {
 | 
			
		||||
    it("resolves files given a set of paths", async () => {
 | 
			
		||||
      assert.deepStrictEqual(
 | 
			
		||||
        paths(["tests/data/**/*", "tests/data/does/not/exist/*"]),
 | 
			
		||||
        ["tests/data/foo/bar.txt"]
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  describe("unmatchedPatterns", () => {
 | 
			
		||||
    it("returns the patterns that don't match any files", async () => {
 | 
			
		||||
      assert.deepStrictEqual(
 | 
			
		||||
        unmatchedPatterns(["tests/data/**/*", "tests/data/does/not/exist/*"]),
 | 
			
		||||
        ["tests/data/does/not/exist/*"]
 | 
			
		||||
      );
 | 
			
		||||
      assert.deepStrictEqual(paths(["tests/data/**/*"]), [
 | 
			
		||||
        "tests/data/foo/bar.txt"
 | 
			
		||||
      ]);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								action.yml
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								action.yml
									
									
									
									
									
								
							@@ -12,9 +12,6 @@ inputs:
 | 
			
		||||
  name:
 | 
			
		||||
    description: 'Gives the release a custom name. Defaults to tag name'
 | 
			
		||||
    required: false
 | 
			
		||||
  tag_name:
 | 
			
		||||
    description: 'Gives a tag name. Defaults to github.GITHUB_REF'
 | 
			
		||||
    required: false
 | 
			
		||||
  draft:
 | 
			
		||||
    description: 'Creates a draft release. Defaults to false'
 | 
			
		||||
    required: false
 | 
			
		||||
@@ -24,27 +21,14 @@ inputs:
 | 
			
		||||
  files:
 | 
			
		||||
    description: 'Newline-delimited list of path globs for asset files to upload'
 | 
			
		||||
    required: false
 | 
			
		||||
  fail_on_unmatched_files:
 | 
			
		||||
    description: 'Fails if any of the `files` globs match nothing. Defaults to false'
 | 
			
		||||
    required: false
 | 
			
		||||
  repository:
 | 
			
		||||
    description: 'Repository to make releases against, in <owner>/<repo> format'
 | 
			
		||||
    required: false
 | 
			
		||||
  target_commitish:
 | 
			
		||||
    description: 'Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA.'
 | 
			
		||||
    required: false
 | 
			
		||||
env:
 | 
			
		||||
  'GITHUB_TOKEN': 'As provided by Github Actions'
 | 
			
		||||
outputs:
 | 
			
		||||
  url:
 | 
			
		||||
    description: 'URL to the Release HTML Page'
 | 
			
		||||
  id:
 | 
			
		||||
    description: 'Release ID'
 | 
			
		||||
  upload_url:
 | 
			
		||||
    description: 'URL for uploading assets to the release'
 | 
			
		||||
runs:
 | 
			
		||||
  using: 'node12'
 | 
			
		||||
  main: 'dist/index.js'
 | 
			
		||||
branding:
 | 
			
		||||
  color: 'green'
 | 
			
		||||
  icon: 'package'
 | 
			
		||||
  icon: 'package'
 | 
			
		||||
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										50
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										50
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1,13 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "action-gh-release",
 | 
			
		||||
  "version": "0.1.6",
 | 
			
		||||
  "version": "0.1.4",
 | 
			
		||||
  "lockfileVersion": 1,
 | 
			
		||||
  "requires": true,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@actions/core": {
 | 
			
		||||
      "version": "1.2.6",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
 | 
			
		||||
      "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
 | 
			
		||||
      "version": "1.2.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz",
 | 
			
		||||
      "integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw=="
 | 
			
		||||
    },
 | 
			
		||||
    "@actions/github": {
 | 
			
		||||
      "version": "2.0.0",
 | 
			
		||||
@@ -434,42 +434,12 @@
 | 
			
		||||
        "universal-user-agent": "^4.0.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "@octokit/plugin-retry": {
 | 
			
		||||
      "version": "3.0.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.2.tgz",
 | 
			
		||||
      "integrity": "sha512-k7xl2WLfLP7WirRXRHtCq5xGAIXBZHV9X3HVUJhPwe8/N8vVzxPcnnnBL5NpEep/+GQqFRdYxrkgz68VY3z2wA==",
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "@octokit/types": "^4.0.1",
 | 
			
		||||
        "bottleneck": "^2.15.3"
 | 
			
		||||
      },
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "@octokit/types": {
 | 
			
		||||
          "version": "4.0.1",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/@octokit/types/-/types-4.0.1.tgz",
 | 
			
		||||
          "integrity": "sha512-Ho6h7w2h9y8RRE8r656hIj1oiSbwbIHJGF5r9G5FOwS2VdDPq8QLGvsG4x6pKHpvyGK7j+43sAc2cJKMiFoIJw==",
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "@types/node": ">= 8"
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "@octokit/plugin-throttling": {
 | 
			
		||||
      "version": "3.2.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-3.2.1.tgz",
 | 
			
		||||
      "integrity": "sha512-CGr3IagYZLLV3pFgpTQUthQSS5K3BkHLlG8yXK+Op3UKBkYrTf+Y9pCebrDxt60d+VTQ1oxXCx+LVLYY3IhBZQ==",
 | 
			
		||||
      "version": "2.7.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-2.7.1.tgz",
 | 
			
		||||
      "integrity": "sha512-08CKNFCpSpmOEAQBn6/MR8zbJgjP4+bplNUJbKlqJSNBHTO1NdsDHzBD4VeFYopOo7rBEySng4WifxNVaQ5bVw==",
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "@octokit/types": "^4.0.1",
 | 
			
		||||
        "bottleneck": "^2.15.3"
 | 
			
		||||
      },
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "@octokit/types": {
 | 
			
		||||
          "version": "4.0.1",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/@octokit/types/-/types-4.0.1.tgz",
 | 
			
		||||
          "integrity": "sha512-Ho6h7w2h9y8RRE8r656hIj1oiSbwbIHJGF5r9G5FOwS2VdDPq8QLGvsG4x6pKHpvyGK7j+43sAc2cJKMiFoIJw==",
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "@types/node": ">= 8"
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "@octokit/request": {
 | 
			
		||||
@@ -3708,9 +3678,9 @@
 | 
			
		||||
      "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
 | 
			
		||||
    },
 | 
			
		||||
    "node-fetch": {
 | 
			
		||||
      "version": "2.6.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
 | 
			
		||||
      "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
 | 
			
		||||
      "version": "2.6.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
 | 
			
		||||
      "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
 | 
			
		||||
    },
 | 
			
		||||
    "node-int64": {
 | 
			
		||||
      "version": "0.4.0",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								package.json
									
									
									
									
									
								
							@@ -1,14 +1,14 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "action-gh-release",
 | 
			
		||||
  "version": "0.1.6",
 | 
			
		||||
  "version": "0.1.4",
 | 
			
		||||
  "private": true,
 | 
			
		||||
  "description": "GitHub Action for creating GitHub Releases",
 | 
			
		||||
  "main": "lib/main.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "build": "ncc build src/main.ts --minify",
 | 
			
		||||
    "test": "jest",
 | 
			
		||||
    "fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
 | 
			
		||||
    "fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\""
 | 
			
		||||
    "fmt": "prettier --write 'src/**/*.ts' '__tests__/**/*.ts'",
 | 
			
		||||
    "fmtcheck": "prettier --check 'src/**/*.ts' '__tests__/**/*.ts'"
 | 
			
		||||
  },
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
@@ -20,10 +20,9 @@
 | 
			
		||||
  "author": "softprops",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@actions/core": "^1.2.6",
 | 
			
		||||
    "@actions/core": "^1.2.0",
 | 
			
		||||
    "@actions/github": "^2.0.0",
 | 
			
		||||
    "@octokit/plugin-retry": "^3.0.2",
 | 
			
		||||
    "@octokit/plugin-throttling": "^3.2.1",
 | 
			
		||||
    "@octokit/plugin-throttling": "^2.7.1",
 | 
			
		||||
    "glob": "^7.1.6",
 | 
			
		||||
    "mime": "^2.4.4"
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
@@ -16,11 +16,8 @@ export interface Release {
 | 
			
		||||
  upload_url: string;
 | 
			
		||||
  html_url: string;
 | 
			
		||||
  tag_name: string;
 | 
			
		||||
  name: string;
 | 
			
		||||
  body: string;
 | 
			
		||||
  target_commitish: string;
 | 
			
		||||
  draft: boolean;
 | 
			
		||||
  prerelease: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface Releaser {
 | 
			
		||||
@@ -38,7 +35,6 @@ export interface Releaser {
 | 
			
		||||
    body: string | undefined;
 | 
			
		||||
    draft: boolean | undefined;
 | 
			
		||||
    prerelease: boolean | undefined;
 | 
			
		||||
    target_commitish: string | undefined;
 | 
			
		||||
  }): Promise<{ data: Release }>;
 | 
			
		||||
 | 
			
		||||
  updateRelease(params: {
 | 
			
		||||
@@ -81,7 +77,6 @@ export class GitHubReleaser implements Releaser {
 | 
			
		||||
    body: string | undefined;
 | 
			
		||||
    draft: boolean | undefined;
 | 
			
		||||
    prerelease: boolean | undefined;
 | 
			
		||||
    target_commitish: string | undefined;
 | 
			
		||||
  }): Promise<{ data: Release }> {
 | 
			
		||||
    return this.github.repos.createRelease(params);
 | 
			
		||||
  }
 | 
			
		||||
@@ -144,17 +139,10 @@ export const upload = async (
 | 
			
		||||
 | 
			
		||||
export const release = async (
 | 
			
		||||
  config: Config,
 | 
			
		||||
  releaser: Releaser,
 | 
			
		||||
  maxRetries: number = 3
 | 
			
		||||
  releaser: Releaser
 | 
			
		||||
): Promise<Release> => {
 | 
			
		||||
  if (maxRetries <= 0) {
 | 
			
		||||
    console.log(`❌ Too many retries. Aborting...`);
 | 
			
		||||
    throw new Error("Too many retries.");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const [owner, repo] = config.github_repository.split("/");
 | 
			
		||||
  const tag =
 | 
			
		||||
    config.input_tag_name || config.github_ref.replace("refs/tags/", "");
 | 
			
		||||
  const tag = config.github_ref.replace("refs/tags/", "");
 | 
			
		||||
  try {
 | 
			
		||||
    // you can't get a an existing draft by tag
 | 
			
		||||
    // so we must find one in the list of all releases
 | 
			
		||||
@@ -176,36 +164,12 @@ export const release = async (
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    const release_id = existingRelease.data.id;
 | 
			
		||||
    let target_commitish: string;
 | 
			
		||||
    if (
 | 
			
		||||
      config.input_target_commitish &&
 | 
			
		||||
      config.input_target_commitish !== existingRelease.data.target_commitish
 | 
			
		||||
    ) {
 | 
			
		||||
      console.log(
 | 
			
		||||
        `Updating commit from "${existingRelease.data.target_commitish}" to "${config.input_target_commitish}"`
 | 
			
		||||
      );
 | 
			
		||||
      target_commitish = config.input_target_commitish;
 | 
			
		||||
    } else {
 | 
			
		||||
      target_commitish = existingRelease.data.target_commitish;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const target_commitish = existingRelease.data.target_commitish;
 | 
			
		||||
    const tag_name = tag;
 | 
			
		||||
    const name = config.input_name || existingRelease.data.name || tag;
 | 
			
		||||
 | 
			
		||||
    let body: string = "";
 | 
			
		||||
    if (existingRelease.data.body) body += existingRelease.data.body;
 | 
			
		||||
    let workflowBody = releaseBody(config);
 | 
			
		||||
    if (existingRelease.data.body && workflowBody) body += "\n";
 | 
			
		||||
    if (workflowBody) body += workflowBody;
 | 
			
		||||
 | 
			
		||||
    const draft =
 | 
			
		||||
      config.input_draft !== undefined
 | 
			
		||||
        ? config.input_draft
 | 
			
		||||
        : existingRelease.data.draft;
 | 
			
		||||
    const prerelease =
 | 
			
		||||
      config.input_prerelease !== undefined
 | 
			
		||||
        ? config.input_prerelease
 | 
			
		||||
        : existingRelease.data.prerelease;
 | 
			
		||||
    const name = config.input_name || tag;
 | 
			
		||||
    const body = `${existingRelease.data.body}\n${releaseBody(config)}`;
 | 
			
		||||
    const draft = config.input_draft;
 | 
			
		||||
    const prerelease = config.input_prerelease;
 | 
			
		||||
 | 
			
		||||
    const release = await releaser.updateRelease({
 | 
			
		||||
      owner,
 | 
			
		||||
@@ -226,14 +190,7 @@ export const release = async (
 | 
			
		||||
      const body = releaseBody(config);
 | 
			
		||||
      const draft = config.input_draft;
 | 
			
		||||
      const prerelease = config.input_prerelease;
 | 
			
		||||
      const target_commitish = config.input_target_commitish;
 | 
			
		||||
      let commitMessage: string = "";
 | 
			
		||||
      if (target_commitish) {
 | 
			
		||||
        commitMessage = ` using commit "${target_commitish}"`;
 | 
			
		||||
      }
 | 
			
		||||
      console.log(
 | 
			
		||||
        `👩🏭 Creating new GitHub release for tag ${tag_name}${commitMessage}...`
 | 
			
		||||
      );
 | 
			
		||||
      console.log(`👩🏭 Creating new GitHub release for tag ${tag_name}...`);
 | 
			
		||||
      try {
 | 
			
		||||
        let release = await releaser.createRelease({
 | 
			
		||||
          owner,
 | 
			
		||||
@@ -242,18 +199,15 @@ export const release = async (
 | 
			
		||||
          name,
 | 
			
		||||
          body,
 | 
			
		||||
          draft,
 | 
			
		||||
          prerelease,
 | 
			
		||||
          target_commitish
 | 
			
		||||
          prerelease
 | 
			
		||||
        });
 | 
			
		||||
        return release.data;
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        // presume a race with competing metrix runs
 | 
			
		||||
        console.log(
 | 
			
		||||
          `⚠️ GitHub release failed with status: ${
 | 
			
		||||
            error.status
 | 
			
		||||
          }, retrying... (${maxRetries - 1} retries remaining)`
 | 
			
		||||
          `⚠️ GitHub release failed with status: ${error.status}, retrying...`
 | 
			
		||||
        );
 | 
			
		||||
        return release(config, releaser, maxRetries - 1);
 | 
			
		||||
        return release(config, releaser);
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      console.log(
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										50
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								src/main.ts
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
import { paths, parseConfig, isTag, unmatchedPatterns } from "./util";
 | 
			
		||||
import { paths, parseConfig, isTag } from "./util";
 | 
			
		||||
import { release, upload, GitHubReleaser } from "./github";
 | 
			
		||||
import { setFailed, setOutput } from "@actions/core";
 | 
			
		||||
import { GitHub } from "@actions/github";
 | 
			
		||||
@@ -7,40 +7,26 @@ import { env } from "process";
 | 
			
		||||
async function run() {
 | 
			
		||||
  try {
 | 
			
		||||
    const config = parseConfig(env);
 | 
			
		||||
    if (!config.input_tag_name && !isTag(config.github_ref)) {
 | 
			
		||||
    if (!isTag(config.github_ref)) {
 | 
			
		||||
      throw new Error(`⚠️ GitHub Releases requires a tag`);
 | 
			
		||||
    }
 | 
			
		||||
    if (config.input_files) {
 | 
			
		||||
      const patterns = unmatchedPatterns(config.input_files);
 | 
			
		||||
      patterns.forEach(pattern =>
 | 
			
		||||
        console.warn(`🤔 Pattern '${pattern}' does not match any files.`)
 | 
			
		||||
      );
 | 
			
		||||
      if (patterns.length > 0 && config.input_fail_on_unmatched_files) {
 | 
			
		||||
        throw new Error(`⚠️ There were unmatched files`);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    GitHub.plugin([
 | 
			
		||||
      require("@octokit/plugin-throttling"),
 | 
			
		||||
      require("@octokit/plugin-retry")
 | 
			
		||||
    ]);
 | 
			
		||||
    GitHub.plugin(require("@octokit/plugin-throttling"));
 | 
			
		||||
    const gh = new GitHub(config.github_token, {
 | 
			
		||||
      throttle: {
 | 
			
		||||
        onRateLimit: (retryAfter, options) => {
 | 
			
		||||
          console.warn(
 | 
			
		||||
            `Request quota exhausted for request ${options.method} ${options.url}`
 | 
			
		||||
          );
 | 
			
		||||
          if (options.request.retryCount === 0) {
 | 
			
		||||
            // only retries once
 | 
			
		||||
            console.log(`Retrying after ${retryAfter} seconds!`);
 | 
			
		||||
            return true;
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        onAbuseLimit: (retryAfter, options) => {
 | 
			
		||||
          // does not retry, only logs a warning
 | 
			
		||||
          console.warn(
 | 
			
		||||
            `Abuse detected for request ${options.method} ${options.url}`
 | 
			
		||||
          );
 | 
			
		||||
      onRateLimit: (retryAfter, options) => {
 | 
			
		||||
        console.warn(
 | 
			
		||||
          `Request quota exhausted for request ${options.method} ${options.url}`
 | 
			
		||||
        );
 | 
			
		||||
        if (options.request.retryCount === 0) {
 | 
			
		||||
          // only retries once
 | 
			
		||||
          console.log(`Retrying after ${retryAfter} seconds!`);
 | 
			
		||||
          return true;
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      onAbuseLimit: (retryAfter, options) => {
 | 
			
		||||
        // does not retry, only logs a warning
 | 
			
		||||
        console.warn(
 | 
			
		||||
          `Abuse detected for request ${options.method} ${options.url}`
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    let rel = await release(config, new GitHubReleaser(gh));
 | 
			
		||||
@@ -55,8 +41,6 @@ async function run() {
 | 
			
		||||
    }
 | 
			
		||||
    console.log(`🎉 Release ready at ${rel.html_url}`);
 | 
			
		||||
    setOutput("url", rel.html_url);
 | 
			
		||||
    setOutput("id", rel.id.toString());
 | 
			
		||||
    setOutput("upload_url", rel.upload_url);
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    setFailed(error.message);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								src/util.ts
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								src/util.ts
									
									
									
									
									
								
							@@ -7,22 +7,18 @@ export interface Config {
 | 
			
		||||
  github_repository: string;
 | 
			
		||||
  // user provided
 | 
			
		||||
  input_name?: string;
 | 
			
		||||
  input_tag_name?: string;
 | 
			
		||||
  input_repository?: string;
 | 
			
		||||
  input_body?: string;
 | 
			
		||||
  input_body_path?: string;
 | 
			
		||||
  input_files?: string[];
 | 
			
		||||
  input_draft?: boolean;
 | 
			
		||||
  input_prerelease?: boolean;
 | 
			
		||||
  input_fail_on_unmatched_files?: boolean;
 | 
			
		||||
  input_target_commitish?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const releaseBody = (config: Config): string | undefined => {
 | 
			
		||||
  return (
 | 
			
		||||
    config.input_body ||
 | 
			
		||||
    (config.input_body_path &&
 | 
			
		||||
      readFileSync(config.input_body_path).toString("utf8")) ||
 | 
			
		||||
    config.input_body
 | 
			
		||||
      readFileSync(config.input_body_path).toString("utf8"))
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -43,18 +39,13 @@ export const parseConfig = (env: Env): Config => {
 | 
			
		||||
  return {
 | 
			
		||||
    github_token: env.GITHUB_TOKEN || "",
 | 
			
		||||
    github_ref: env.GITHUB_REF || "",
 | 
			
		||||
    github_repository: env.INPUT_REPOSITORY || env.GITHUB_REPOSITORY || "",
 | 
			
		||||
    github_repository: env.GITHUB_REPOSITORY || "",
 | 
			
		||||
    input_name: env.INPUT_NAME,
 | 
			
		||||
    input_tag_name: env.INPUT_TAG_NAME,
 | 
			
		||||
    input_body: env.INPUT_BODY,
 | 
			
		||||
    input_body_path: env.INPUT_BODY_PATH,
 | 
			
		||||
    input_files: parseInputFiles(env.INPUT_FILES || ""),
 | 
			
		||||
    input_draft: env.INPUT_DRAFT ? env.INPUT_DRAFT === "true" : undefined,
 | 
			
		||||
    input_prerelease: env.INPUT_PRERELEASE
 | 
			
		||||
      ? env.INPUT_PRERELEASE == "true"
 | 
			
		||||
      : undefined,
 | 
			
		||||
    input_fail_on_unmatched_files: env.INPUT_FAIL_ON_UNMATCHED_FILES == "true",
 | 
			
		||||
    input_target_commitish: env.INPUT_TARGET_COMMITISH
 | 
			
		||||
    input_draft: env.INPUT_DRAFT === "true",
 | 
			
		||||
    input_prerelease: env.INPUT_PRERELEASE == "true"
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -66,16 +57,6 @@ export const paths = (patterns: string[]): string[] => {
 | 
			
		||||
  }, []);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const unmatchedPatterns = (patterns: string[]): string[] => {
 | 
			
		||||
  return patterns.reduce((acc: string[], pattern: string): string[] => {
 | 
			
		||||
    return acc.concat(
 | 
			
		||||
      glob.sync(pattern).filter(path => lstatSync(path).isFile()).length == 0
 | 
			
		||||
        ? [pattern]
 | 
			
		||||
        : []
 | 
			
		||||
    );
 | 
			
		||||
  }, []);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const isTag = (ref: string): boolean => {
 | 
			
		||||
  return ref.startsWith("refs/tags/");
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user