1 Commits

Author SHA1 Message Date
Nick Cipollo
d95f7f9bad Prepare v1.8.1 release
Some checks failed
PR Checks / check_pr (push) Has been cancelled
2021-03-12 12:47:06 -05:00
31 changed files with 458 additions and 668 deletions

View File

@@ -1,28 +0,0 @@
name: "PR Checks"
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "yarn install"
run: yarn install
- name: "yarn build"
run: yarn build
- name: "check for uncommitted changes"
# Ensure no changes, but ignore node_modules dir since dev/fresh ci deps installed.
run: |
git diff --exit-code --stat -- . ':!node_modules' \
|| (echo "##[error] found changed files after build. please 'yarn build && npm run format'" \
"and check in all changes" \
&& exit 1)

25
.github/workflows/checkin.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: "PR Checks"
on: [pull_request, push]
jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "yarn install"
run: yarn install
- name: "yarn build"
run: yarn build
- name: "yarn test"
run: yarn test
- name: "check for uncommitted changes"
# Ensure no changes, but ignore node_modules dir since dev/fresh ci deps installed.
run: |
git diff --exit-code --stat -- . ':!node_modules' \
|| (echo "##[error] found changed files after build. please 'yarn build && npm run format'" \
"and check in all changes" \
&& exit 1)

View File

@@ -1,14 +0,0 @@
name: "Test"
on: [push, pull_request]
jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "yarn install"
run: yarn install
- name: "yarn test"
run: yarn test

View File

@@ -4,14 +4,12 @@ This action will create a github release and optionally upload an artifact to it
## Action Inputs
- **allowUpdates**: An optional flag which indicates if we should update a release if it already exists. Defaults to false.
- **artifactErrorsFailBuild**: An optional flag which indicates if artifact read or upload errors should fail the build.
- **artifact**: An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs).
- **artifacts**: An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs).
- **artifactContentType**: The content type of the artifact. Defaults to raw.
- **body**: An optional body for the release.
- **bodyFile**: An optional body file for the release. This should be the path to the file.
- **commit**: An optional commit reference. This will be used to create the tag if it does not exist.
- **discussionCategory**: When provided this will generate a discussion of the specified category. The category must exist otherwise this will cause the action to fail. This isn't used with draft releases.
- **draft**: Optionally marks this release as a draft release. Set to `true` to enable.
- **name**: An optional name for the release. If this is omitted the tag will be used.
- **omitBody**: Indicates if the release body should be omitted.

View File

@@ -20,7 +20,6 @@ const artifacts = [
const createBody = 'createBody'
const createName = 'createName'
const commit = 'commit'
const discussionCategory = 'discussionCategory'
const draft = true
const id = 100
const prerelease = true
@@ -46,7 +45,7 @@ describe("Action", () => {
await action.perform()
expect(createMock).toBeCalledWith(tag, createBody, commit, discussionCategory, draft, createName, prerelease)
expect(createMock).toBeCalledWith(tag, createBody, commit, draft, createName, prerelease)
expect(uploadMock).not.toBeCalled()
})
@@ -57,7 +56,7 @@ describe("Action", () => {
await action.perform()
expect(createMock).toBeCalledWith(tag, createBody, commit, discussionCategory, draft, createName, prerelease)
expect(createMock).toBeCalledWith(tag, createBody, commit, draft, createName, prerelease)
expect(uploadMock).toBeCalledWith(artifacts, releaseId, url)
})
@@ -73,7 +72,7 @@ describe("Action", () => {
await action.perform()
expect(createMock).toBeCalledWith(tag, createBody, commit, discussionCategory, draft, createName, prerelease)
expect(createMock).toBeCalledWith(tag, createBody, commit, draft, createName, prerelease)
expect(uploadMock).toBeCalledWith(artifacts, releaseId, url)
})
@@ -83,7 +82,7 @@ describe("Action", () => {
await action.perform()
expect(createMock).toBeCalledWith(tag, createBody, commit, discussionCategory, draft, createName, prerelease)
expect(createMock).toBeCalledWith(tag, createBody, commit, draft, createName, prerelease)
expect(uploadMock).toBeCalledWith(artifacts, releaseId, url)
})
@@ -98,7 +97,7 @@ describe("Action", () => {
expect(error).toEqual("error")
}
expect(createMock).toBeCalledWith(tag, createBody, commit, discussionCategory, draft, createName, prerelease)
expect(createMock).toBeCalledWith(tag, createBody, commit, draft, createName, prerelease)
expect(uploadMock).not.toBeCalled()
})
@@ -139,32 +138,22 @@ describe("Action", () => {
expect(error).toEqual("error")
}
expect(updateMock).toBeCalledWith(
id,
tag,
updateBody,
commit,
discussionCategory,
draft,
updateName,
prerelease
)
expect(updateMock).toBeCalledWith(id, tag, updateBody, commit, draft, updateName, prerelease)
expect(uploadMock).not.toBeCalled()
})
it('throws error when upload fails', async () => {
const action = createAction(false, true)
const expectedError = {status: 404}
uploadMock.mockRejectedValue(expectedError)
uploadMock.mockRejectedValue("error")
expect.hasAssertions()
try {
await action.perform()
} catch (error) {
expect(error).toEqual(expectedError)
expect(error).toEqual("error")
}
expect(createMock).toBeCalledWith(tag, createBody, commit, discussionCategory, draft, createName, prerelease)
expect(createMock).toBeCalledWith(tag, createBody, commit, draft, createName, prerelease)
expect(uploadMock).toBeCalledWith(artifacts, releaseId, url)
})
@@ -181,16 +170,7 @@ describe("Action", () => {
await action.perform()
expect(updateMock).toBeCalledWith(
id,
tag,
updateBody,
commit,
discussionCategory,
draft,
updateName,
prerelease
)
expect(updateMock).toBeCalledWith(id, tag, updateBody, commit, draft, updateName, prerelease)
expect(uploadMock).toBeCalledWith(artifacts, releaseId, url)
})
@@ -200,16 +180,7 @@ describe("Action", () => {
await action.perform()
expect(updateMock).toBeCalledWith(
id,
tag,
updateBody,
commit,
discussionCategory,
draft,
updateName,
prerelease
)
expect(updateMock).toBeCalledWith(id, tag, updateBody, commit, draft, updateName, prerelease)
expect(uploadMock).not.toBeCalled()
})
@@ -219,16 +190,7 @@ describe("Action", () => {
await action.perform()
expect(updateMock).toBeCalledWith(
id,
tag,
updateBody,
commit,
discussionCategory,
draft,
updateName,
prerelease
)
expect(updateMock).toBeCalledWith(id, tag, updateBody, commit, draft, updateName, prerelease)
expect(uploadMock).toBeCalledWith(artifacts, releaseId, url)
})
@@ -277,12 +239,10 @@ describe("Action", () => {
const MockInputs = jest.fn<Inputs, any>(() => {
return {
allowUpdates: allowUpdates,
artifactErrorsFailBuild: true,
artifacts: inputArtifact,
createdReleaseBody: createBody,
createdReleaseName: createName,
commit: commit,
discussionCategory: discussionCategory,
draft: draft,
owner: "owner",
prerelease: prerelease,

View File

@@ -1,8 +1,8 @@
const warnMock = jest.fn()
import {FileArtifactGlobber} from "../src/ArtifactGlobber"
import {Globber} from "../src/Globber";
import {Artifact} from "../src/Artifact";
import { FileArtifactGlobber } from "../src/ArtifactGlobber"
import { Globber } from "../src/Globber";
import { Artifact } from "../src/Artifact";
import untildify = require("untildify");
const contentType = "raw"
@@ -24,19 +24,19 @@ describe("ArtifactGlobber", () => {
const expectedArtifacts =
globResults.map((path) => new Artifact(path, contentType))
expect(globber.globArtifactString('~/path', 'raw', false))
expect(globber.globArtifactString('~/path', 'raw'))
.toEqual(expectedArtifacts)
expect(globMock).toBeCalledWith(untildify('~/path'))
expect(warnMock).not.toBeCalled()
})
it("globs simple path", () => {
const globber = createArtifactGlobber()
const expectedArtifacts =
globResults.map((path) => new Artifact(path, contentType))
expect(globber.globArtifactString('path', 'raw', false))
expect(globber.globArtifactString('path', 'raw'))
.toEqual(expectedArtifacts)
expect(globMock).toBeCalledWith('path')
expect(warnMock).not.toBeCalled()
@@ -50,28 +50,24 @@ describe("ArtifactGlobber", () => {
.concat(globResults)
.map((path) => new Artifact(path, contentType))
expect(globber.globArtifactString('path1,path2', 'raw', false))
expect(globber.globArtifactString('path1,path2', 'raw'))
.toEqual(expectedArtifacts)
expect(globMock).toBeCalledWith('path1')
expect(globMock).toBeCalledWith('path2')
expect(warnMock).not.toBeCalled()
})
it("warns when no glob results are produced and empty results shouldn't throw", () => {
it("warns when no glob results are produced", () => {
const globber = createArtifactGlobber([])
expect(globber.globArtifactString('path', 'raw', false))
const expectedArtifacts =
globResults.map((path) => new Artifact(path, contentType))
expect(globber.globArtifactString('path', 'raw'))
.toEqual([])
expect(warnMock).toBeCalled()
})
it("throws when no glob results are produced and empty results shouild throw", () => {
const globber = createArtifactGlobber([])
expect(() => {
globber.globArtifactString('path', 'raw', true)
}).toThrow()
})
function createArtifactGlobber(results: string[] = globResults): FileArtifactGlobber {
const MockGlobber = jest.fn<Globber, any>(() => {
return {

View File

@@ -1,7 +1,7 @@
import {Artifact} from "../src/Artifact"
import {GithubArtifactUploader} from "../src/ArtifactUploader"
import {Releases} from "../src/Releases";
import {RequestError} from '@octokit/request-error'
import { Artifact } from "../src/Artifact"
import { GithubArtifactUploader } from "../src/ArtifactUploader"
import { Releases } from "../src/Releases";
import { RequestError } from '@octokit/request-error'
const artifacts = [
new Artifact('a/art1'),
@@ -19,9 +19,7 @@ const uploadMock = jest.fn()
jest.mock('fs', () => {
return {
readFileSync: () => fileContents,
statSync: () => {
return {size: contentLength}
}
statSync: () => { return { size: contentLength } }
};
})
@@ -126,19 +124,6 @@ describe('ArtifactUploader', () => {
expect(deleteMock).toBeCalledTimes(0)
})
it('throws upload error when replacesExistingArtifacts is true', async () => {
mockListWithoutAssets()
mockUploadError()
const uploader = createUploader(true, true)
expect.hasAssertions()
try {
await uploader.uploadArtifacts(artifacts, releaseId, url)
} catch (error) {
expect(error).toEqual(Error("Failed to upload artifact art1. error."))
}
})
it('throws error from replace', async () => {
mockDeleteError()
mockListWithAssets()
@@ -170,7 +155,7 @@ describe('ArtifactUploader', () => {
expect(deleteMock).toBeCalledTimes(0)
})
function createUploader(replaces: boolean, throws: boolean = false): GithubArtifactUploader {
function createUploader(replaces: boolean): GithubArtifactUploader {
const MockReleases = jest.fn<Releases, any>(() => {
return {
create: jest.fn(),
@@ -182,7 +167,7 @@ describe('ArtifactUploader', () => {
uploadArtifact: uploadMock
}
})
return new GithubArtifactUploader(new MockReleases(), replaces, throws)
return new GithubArtifactUploader(new MockReleases(), replaces)
}
function mockDeleteError(): any {
@@ -209,24 +194,14 @@ describe('ArtifactUploader', () => {
}
function mockListWithoutAssets() {
listArtifactsMock.mockResolvedValue({data: []})
listArtifactsMock.mockResolvedValue({ data: [] })
}
function mockUploadArtifact(status: number = 200, failures: number = 0) {
const error = new RequestError(`HTTP ${status}`, status, {
headers: {},
request: {method: 'GET', url: '', headers: {}}
})
const error = new RequestError(`HTTP ${status}`, status, { headers: {}, request: { method: 'GET', url: '', headers: {} } })
for (let index = 0; index < failures; index++) {
uploadMock.mockRejectedValueOnce(error)
}
uploadMock.mockResolvedValue({})
}
function mockUploadError() {
uploadMock.mockRejectedValue({
message: "error",
status: 502
})
}
});

View File

@@ -0,0 +1,70 @@
import { ErrorMessage } from "../src/ErrorMessage"
describe('ErrorMessage', () => {
describe('has error with code', () => {
const error = {
message: 'something bad happened',
errors: [
{
code: 'missing',
resource: 'release'
},
{
code: 'already_exists',
resource: 'release'
}
],
status: 422
}
it('does not have error', () => {
const errorMessage = new ErrorMessage(error)
expect(errorMessage.hasErrorWithCode('missing_field')).toBeFalsy()
})
it('has error', () => {
const errorMessage = new ErrorMessage(error)
expect(errorMessage.hasErrorWithCode('missing')).toBeTruthy()
})
})
it('generates message with errors', () => {
const error = {
message: 'something bad happened',
errors: [
{
code: 'missing',
resource: 'release'
},
{
code: 'already_exists',
resource: 'release'
}
],
status: 422
}
const errorMessage = new ErrorMessage(error)
const expectedString = "Error 422: something bad happened\nErrors:\n- release does not exist.\n- release already exists."
expect(errorMessage.toString()).toBe(expectedString)
})
it('generates message without errors', () => {
const error = {
message: 'something bad happened',
status: 422
}
const errorMessage = new ErrorMessage(error)
expect(errorMessage.toString()).toBe('Error 422: something bad happened')
})
it('provides error status', () => {
const error = { status: 404 }
const errorMessage = new ErrorMessage(error)
expect(errorMessage.status).toBe(404)
})
})

View File

@@ -1,70 +1,99 @@
import { GithubError } from "../src/GithubError"
describe('ErrorMessage', () => {
describe('GithubError', () => {
describe('has error with code', () => {
it('provides error code', () => {
const error = {
message: 'something bad happened',
errors: [
{
code: 'missing',
resource: 'release'
},
{
code: 'already_exists',
resource: 'release'
}
],
status: 422
code: "missing"
}
it('does not have error', () => {
const githubError = new GithubError(error)
expect(githubError.code).toBe('missing')
})
it('generates missing resource error message', () => {
const resource = "release"
const error = {
code: "missing",
resource: resource
}
const githubError = new GithubError(error)
const message = githubError.toString()
expect(message).toBe(`${resource} does not exist.`)
})
it('generates missing field error message', () => {
const resource = "release"
const field = "body"
const error = {
code: "missing_field",
field: field,
resource: resource
}
const githubError = new GithubError(error)
const message = githubError.toString()
expect(message).toBe(`The ${field} field on ${resource} is missing.`)
})
it('generates invalid field error message', () => {
const resource = "release"
const field = "body"
const error = {
code: "invalid",
field: field,
resource: resource
}
const githubError = new GithubError(error)
const message = githubError.toString()
expect(message).toBe(`The ${field} field on ${resource} is an invalid format.`)
})
it('generates resource already exists error message', () => {
const resource = "release"
const field = "body"
const error = {
code: "already_exists",
resource: resource
}
const githubError = new GithubError(error)
const message = githubError.toString()
expect(message).toBe(`${resource} already exists.`)
})
describe('generates custom error message', () => {
it('with documentation url', () => {
const url = "https://api.example.com"
const error = {
code: "custom",
message: "foo",
documentation_url: url
}
const githubError = new GithubError(error)
expect(githubError.hasErrorWithCode('missing_field')).toBeFalsy()
const message = githubError.toString()
expect(message).toBe(`foo\nPlease see ${url}.`)
})
it('has error', () => {
it('without documentation url', () => {
const error = {
code: "custom",
message: "foo"
}
const githubError = new GithubError(error)
expect(githubError.hasErrorWithCode('missing')).toBeTruthy()
const message = githubError.toString()
expect(message).toBe('foo')
})
})
it('generates message with errors', () => {
const error = {
message: 'something bad happened',
errors: [
{
code: 'missing',
resource: 'release'
},
{
code: 'already_exists',
resource: 'release'
}
],
status: 422
}
const githubError = new GithubError(error)
const expectedString = "Error 422: something bad happened\nErrors:\n- release does not exist.\n- release already exists."
expect(githubError.toString()).toBe(expectedString)
})
it('generates message without errors', () => {
const error = {
message: 'something bad happened',
status: 422
}
const githubError = new GithubError(error)
expect(githubError.toString()).toBe('Error 422: something bad happened')
})
it('provides error status', () => {
const error = { status: 404 }
const githubError = new GithubError(error)
expect(githubError.status).toBe(404)
})
})
})

View File

@@ -1,98 +0,0 @@
import { GithubErrorDetail } from "../src/GithubErrorDetail"
describe('GithubErrorDetail', () => {
it('provides error code', () => {
const error = {
code: "missing"
}
const detail = new GithubErrorDetail(error)
expect(detail.code).toBe('missing')
})
it('generates missing resource error message', () => {
const resource = "release"
const error = {
code: "missing",
resource: resource
}
const detail = new GithubErrorDetail(error)
const message = detail.toString()
expect(message).toBe(`${resource} does not exist.`)
})
it('generates missing field error message', () => {
const resource = "release"
const field = "body"
const error = {
code: "missing_field",
field: field,
resource: resource
}
const detail = new GithubErrorDetail(error)
const message = detail.toString()
expect(message).toBe(`The ${field} field on ${resource} is missing.`)
})
it('generates invalid field error message', () => {
const resource = "release"
const field = "body"
const error = {
code: "invalid",
field: field,
resource: resource
}
const detail = new GithubErrorDetail(error)
const message = detail.toString()
expect(message).toBe(`The ${field} field on ${resource} is an invalid format.`)
})
it('generates resource already exists error message', () => {
const resource = "release"
const error = {
code: "already_exists",
resource: resource
}
const detail = new GithubErrorDetail(error)
const message = detail.toString()
expect(message).toBe(`${resource} already exists.`)
})
describe('generates custom error message', () => {
it('with documentation url', () => {
const url = "https://api.example.com"
const error = {
code: "custom",
message: "foo",
documentation_url: url
}
const detail = new GithubErrorDetail(error)
const message = detail.toString()
expect(message).toBe(`foo\nPlease see ${url}.`)
})
it('without documentation url', () => {
const error = {
code: "custom",
message: "foo"
}
const detail = new GithubErrorDetail(error)
const message = detail.toString()
expect(message).toBe('foo')
})
})
})

View File

@@ -59,28 +59,7 @@ describe('Inputs', () => {
})
})
describe('artifactErrorsFailBuild', () => {
it('returns false', () => {
expect(inputs.artifactErrorsFailBuild).toBe(false)
})
it('returns true', () => {
mockGetInput.mockReturnValue('true')
expect(inputs.artifactErrorsFailBuild).toBe(true)
})
})
describe('artifacts', () => {
it('globber told to throw errors', () => {
mockGetInput.mockReturnValueOnce('art1')
.mockReturnValueOnce('contentType')
.mockReturnValueOnce('true')
expect(inputs.artifacts).toEqual(artifacts)
expect(mockGlob).toBeCalledTimes(1)
expect(mockGlob).toBeCalledWith('art1', 'contentType', true)
})
it('returns empty artifacts', () => {
mockGetInput.mockReturnValueOnce('')
.mockReturnValueOnce('')
@@ -92,32 +71,28 @@ describe('Inputs', () => {
it('returns input.artifacts', () => {
mockGetInput.mockReturnValueOnce('art1')
.mockReturnValueOnce('contentType')
.mockReturnValueOnce('false')
expect(inputs.artifacts).toEqual(artifacts)
expect(mockGlob).toBeCalledTimes(1)
expect(mockGlob).toBeCalledWith('art1', 'contentType', false)
expect(mockGlob).toBeCalledWith('art1', 'contentType')
})
it('returns input.artifacts with default contentType', () => {
mockGetInput.mockReturnValueOnce('art1')
.mockReturnValueOnce('raw')
.mockReturnValueOnce('false')
expect(inputs.artifacts).toEqual(artifacts)
expect(mockGlob).toBeCalledTimes(1)
expect(mockGlob).toBeCalledWith('art1', 'raw', false)
expect(mockGlob).toBeCalledWith('art1', 'raw')
})
it('returns input.artifact', () => {
mockGetInput.mockReturnValueOnce('')
.mockReturnValueOnce('art2')
.mockReturnValueOnce('contentType')
.mockReturnValueOnce('false')
expect(inputs.artifacts).toEqual(artifacts)
expect(mockGlob).toBeCalledTimes(1)
expect(mockGlob).toBeCalledWith('art2', 'contentType', false)
expect(mockGlob).toBeCalledWith('art2', 'contentType')
})
})
@@ -179,18 +154,6 @@ describe('Inputs', () => {
})
})
describe('discussionCategory', () => {
it('returns category', () => {
mockGetInput.mockReturnValue('Release')
expect(inputs.discussionCategory).toBe('Release')
})
it('returns undefined', () => {
mockGetInput.mockReturnValue('')
expect(inputs.discussionCategory).toBe(undefined)
})
})
describe('draft', () => {
it('returns false', () => {
expect(inputs.draft).toBe(false)
@@ -201,7 +164,7 @@ describe('Inputs', () => {
expect(inputs.draft).toBe(true)
})
})
describe('owner', () => {
it('returns owner from context', function () {
process.env.GITHUB_REPOSITORY = "owner/repo"
@@ -212,7 +175,7 @@ describe('Inputs', () => {
mockGetInput.mockReturnValue("owner")
expect(inputs.owner).toBe("owner")
});
})
})
describe('prerelase', () => {
it('returns false', () => {

View File

@@ -18,11 +18,7 @@ describe.skip('Integration Test', () => {
const inputs = getInputs()
const releases = new GithubReleases(inputs, git)
const uploader = new GithubArtifactUploader(
releases,
inputs.replacesArtifacts,
inputs.artifactErrorsFailBuild,
)
const uploader = new GithubArtifactUploader(releases, inputs.replacesArtifacts)
action = new Action(inputs, releases, uploader)
})
@@ -34,12 +30,10 @@ describe.skip('Integration Test', () => {
const MockInputs = jest.fn<Inputs, any>(() => {
return {
allowUpdates: true,
artifactErrorsFailBuild: false,
artifacts: artifacts(),
createdReleaseBody: "This release was generated by release-action's integration test",
createdReleaseName: "Releases Action Integration Test 2",
createdReleaseName: "Releases Action Integration Test",
commit: "",
discussionCategory: 'Release',
draft: false,
owner: "ncipollo",
prerelease: false,
@@ -48,17 +42,17 @@ describe.skip('Integration Test', () => {
tag: "release-action-test",
token: getToken(),
updatedReleaseBody: "This release was generated by release-action's integration test",
updatedReleaseName: "Releases Action Integration Test 2"
updatedReleaseName: "Releases Action Integration Test"
}
})
return new MockInputs();
}
function artifacts() {
const globber = new FileArtifactGlobber()
const artifactPath = path.join(__dirname, 'Integration.test.ts')
const artifactString = `~/Desktop/test.txt,blarg.tx, ${artifactPath}`
return globber.globArtifactString(artifactString, "raw", false)
return globber.globArtifactString(artifactString, "raw")
}
function getToken(): string {

View File

@@ -6,10 +6,6 @@ inputs:
description: 'An optional flag which indicates if we should update a release if it already exists. Defaults to false.'
required: false
default: ''
artifactErrorsFailBuild:
description: 'An optional flag which indicates if artifact read or upload errors should fail the build.'
required: false
default: ''
artifact:
deprecationMessage: Use 'artifacts' instead.
description: 'An optional set of paths representing artifacts to upload to the release. This may be a single path or a comma delimited list of paths (or globs)'
@@ -34,10 +30,6 @@ inputs:
commit:
description: "An optional commit reference. This will be used to create the tag if it does not exist."
required: false
default: ''
discussionCategory:
description: "When provided this will generate a discussion of the specified category. The category must exist otherwise this will cause the action to fail. This isn't used with draft releases"
required: false
default: ''
draft:
description: "Optionally marks this release as a draft release. Set to true to enable."

View File

@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Action = void 0;
const GithubError_1 = require("./GithubError");
const ErrorMessage_1 = require("./ErrorMessage");
class Action {
constructor(inputs, releases, uploader) {
this.inputs = inputs;
@@ -31,38 +31,32 @@ class Action {
createOrUpdateRelease() {
return __awaiter(this, void 0, void 0, function* () {
if (this.inputs.allowUpdates) {
let getResponse;
try {
getResponse = yield this.releases.getByTag(this.inputs.tag);
const getResponse = yield this.releases.getByTag(this.inputs.tag);
return yield this.updateRelease(getResponse.data.id);
}
catch (error) {
return yield this.checkForMissingReleaseError(error);
if (Action.noPublishedRelease(error)) {
return yield this.updateDraftOrCreateRelease();
}
else {
throw error;
}
}
return yield this.updateRelease(getResponse.data.id);
}
else {
return yield this.createRelease();
}
});
}
checkForMissingReleaseError(error) {
return __awaiter(this, void 0, void 0, function* () {
if (Action.noPublishedRelease(error)) {
return yield this.updateDraftOrCreateRelease();
}
else {
throw error;
}
});
}
updateRelease(id) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.draft, this.inputs.updatedReleaseName, this.inputs.prerelease);
return yield this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.draft, this.inputs.updatedReleaseName, this.inputs.prerelease);
});
}
static noPublishedRelease(error) {
const githubError = new GithubError_1.GithubError(error);
return githubError.status == 404;
const errorMessage = new ErrorMessage_1.ErrorMessage(error);
return errorMessage.status == 404;
}
updateDraftOrCreateRelease() {
return __awaiter(this, void 0, void 0, function* () {
@@ -86,7 +80,8 @@ class Action {
}
createRelease() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.draft, this.inputs.createdReleaseName, this.inputs.prerelease);
const response = yield this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.draft, this.inputs.createdReleaseName, this.inputs.prerelease);
return response;
});
}
}

View File

@@ -31,31 +31,23 @@ class FileArtifactGlobber {
constructor(globber = new Globber_1.FileGlobber()) {
this.globber = globber;
}
globArtifactString(artifact, contentType, throwsWhenNoFiles) {
globArtifactString(artifact, contentType) {
return artifact.split(',')
.map(path => FileArtifactGlobber.expandPath(path))
.map(pattern => this.globPattern(pattern, throwsWhenNoFiles))
.map(pattern => this.globPattern(pattern))
.reduce((accumulated, current) => accumulated.concat(current))
.map(path => new Artifact_1.Artifact(path, contentType));
}
globPattern(pattern, throwsWhenNoFiles) {
globPattern(pattern) {
const paths = this.globber.glob(pattern);
if (paths.length == 0) {
if (throwsWhenNoFiles) {
FileArtifactGlobber.throwGlobError(pattern);
}
else {
FileArtifactGlobber.reportGlobWarning(pattern);
}
FileArtifactGlobber.reportGlobWarning(pattern);
}
return paths;
}
static reportGlobWarning(pattern) {
core.warning(`Artifact pattern :${pattern} did not match any files`);
}
static throwGlobError(pattern) {
throw Error(`Artifact pattern :${pattern} did not match any files`);
}
static expandPath(path) {
return untildify_1.default(path);
}

View File

@@ -31,10 +31,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.GithubArtifactUploader = void 0;
const core = __importStar(require("@actions/core"));
class GithubArtifactUploader {
constructor(releases, replacesExistingArtifacts = true, throwsUploadErrors = false) {
constructor(releases, replacesExistingArtifacts = true) {
this.releases = releases;
this.replacesExistingArtifacts = replacesExistingArtifacts;
this.throwsUploadErrors = throwsUploadErrors;
}
uploadArtifacts(artifacts, releaseId, uploadUrl) {
return __awaiter(this, void 0, void 0, function* () {
@@ -58,12 +57,7 @@ class GithubArtifactUploader {
yield this.uploadArtifact(artifact, releaseId, uploadUrl, retry - 1);
}
else {
if (this.throwsUploadErrors) {
throw Error(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
}
else {
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
}
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
}
}
});

40
lib/ErrorMessage.js Normal file
View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrorMessage = void 0;
const GithubError_1 = require("./GithubError");
class ErrorMessage {
constructor(error) {
this.error = error;
this.githubErrors = this.generateGithubErrors();
}
generateGithubErrors() {
const errors = this.error.errors;
if (errors instanceof Array) {
return errors.map((err) => new GithubError_1.GithubError(err));
}
else {
return [];
}
}
get status() {
return this.error.status;
}
hasErrorWithCode(code) {
return this.githubErrors.some((err) => err.code == code);
}
toString() {
const message = this.error.message;
const errors = this.githubErrors;
const status = this.status;
if (errors.length > 0) {
return `Error ${status}: ${message}\nErrors:\n${this.errorBulletedList(errors)}`;
}
else {
return `Error ${status}: ${message}`;
}
}
errorBulletedList(errors) {
return errors.map((err) => `- ${err}`).join("\n");
}
}
exports.ErrorMessage = ErrorMessage;

View File

@@ -1,40 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GithubError = void 0;
const GithubErrorDetail_1 = require("./GithubErrorDetail");
class GithubError {
constructor(error) {
this.error = error;
this.githubErrors = this.generateGithubErrors();
}
generateGithubErrors() {
const errors = this.error.errors;
if (errors instanceof Array) {
return errors.map((err) => new GithubErrorDetail_1.GithubErrorDetail(err));
}
else {
return [];
}
}
get status() {
return this.error.status;
}
hasErrorWithCode(code) {
return this.githubErrors.some((err) => err.code == code);
get code() {
return this.error.code;
}
toString() {
const message = this.error.message;
const errors = this.githubErrors;
const status = this.status;
if (errors.length > 0) {
return `Error ${status}: ${message}\nErrors:\n${this.errorBulletedList(errors)}`;
}
else {
return `Error ${status}: ${message}`;
const code = this.error.code;
switch (code) {
case 'missing':
return this.missingResourceMessage();
case 'missing_field':
return this.missingFieldMessage();
case 'invalid':
return this.invalidFieldMessage();
case 'already_exists':
return this.resourceAlreadyExists();
default:
return this.customErrorMessage();
}
}
errorBulletedList(errors) {
return errors.map((err) => `- ${err}`).join("\n");
customErrorMessage() {
const message = this.error.message;
const documentation = this.error.documentation_url;
let documentationMessage;
if (documentation) {
documentationMessage = `\nPlease see ${documentation}.`;
}
else {
documentationMessage = "";
}
return `${message}${documentationMessage}`;
}
invalidFieldMessage() {
const resource = this.error.resource;
const field = this.error.field;
return `The ${field} field on ${resource} is an invalid format.`;
}
missingResourceMessage() {
const resource = this.error.resource;
return `${resource} does not exist.`;
}
missingFieldMessage() {
const resource = this.error.resource;
const field = this.error.field;
return `The ${field} field on ${resource} is missing.`;
}
resourceAlreadyExists() {
const resource = this.error.resource;
return `${resource} already exists.`;
}
}
exports.GithubError = GithubError;

View File

@@ -1,57 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GithubErrorDetail = void 0;
class GithubErrorDetail {
constructor(error) {
this.error = error;
}
get code() {
return this.error.code;
}
toString() {
const code = this.error.code;
switch (code) {
case 'missing':
return this.missingResourceMessage();
case 'missing_field':
return this.missingFieldMessage();
case 'invalid':
return this.invalidFieldMessage();
case 'already_exists':
return this.resourceAlreadyExists();
default:
return this.customErrorMessage();
}
}
customErrorMessage() {
const message = this.error.message;
const documentation = this.error.documentation_url;
let documentationMessage;
if (documentation) {
documentationMessage = `\nPlease see ${documentation}.`;
}
else {
documentationMessage = "";
}
return `${message}${documentationMessage}`;
}
invalidFieldMessage() {
const resource = this.error.resource;
const field = this.error.field;
return `The ${field} field on ${resource} is an invalid format.`;
}
missingResourceMessage() {
const resource = this.error.resource;
return `${resource} does not exist.`;
}
missingFieldMessage() {
const resource = this.error.resource;
const field = this.error.field;
return `The ${field} field on ${resource} is missing.`;
}
resourceAlreadyExists() {
const resource = this.error.resource;
return `${resource} already exists.`;
}
}
exports.GithubErrorDetail = GithubErrorDetail;

View File

@@ -42,14 +42,10 @@ class CoreInputs {
contentType = 'raw';
}
return this.artifactGlobber
.globArtifactString(artifacts, contentType, this.artifactErrorsFailBuild);
.globArtifactString(artifacts, contentType);
}
return [];
}
get artifactErrorsFailBuild() {
const allow = core.getInput('artifactErrorsFailBuild');
return allow == 'true';
}
get createdReleaseBody() {
if (CoreInputs.omitBody)
return undefined;
@@ -77,13 +73,6 @@ class CoreInputs {
return undefined;
return this.name;
}
get discussionCategory() {
const category = core.getInput('discussionCategory');
if (category) {
return category;
}
return undefined;
}
static get omitName() {
return core.getInput('omitName') == 'true';
}

View File

@@ -35,7 +35,7 @@ const Releases_1 = require("./Releases");
const Action_1 = require("./Action");
const ArtifactUploader_1 = require("./ArtifactUploader");
const ArtifactGlobber_1 = require("./ArtifactGlobber");
const GithubError_1 = require("./GithubError");
const ErrorMessage_1 = require("./ErrorMessage");
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
@@ -43,8 +43,8 @@ function run() {
yield action.perform();
}
catch (error) {
const githubError = new GithubError_1.GithubError(error);
core.setFailed(githubError.toString());
const errorMessage = new ErrorMessage_1.ErrorMessage(error);
core.setFailed(errorMessage.toString());
}
});
}
@@ -55,7 +55,7 @@ function createAction() {
const globber = new ArtifactGlobber_1.FileArtifactGlobber();
const inputs = new Inputs_1.CoreInputs(globber, context);
const releases = new Releases_1.GithubReleases(inputs, git);
const uploader = new ArtifactUploader_1.GithubArtifactUploader(releases, inputs.replacesArtifacts, inputs.artifactErrorsFailBuild);
const uploader = new ArtifactUploader_1.GithubArtifactUploader(releases, inputs.replacesArtifacts);
return new Action_1.Action(inputs, releases, uploader);
}
run();

View File

@@ -15,13 +15,12 @@ class GithubReleases {
this.inputs = inputs;
this.git = git;
}
create(tag, body, commitHash, discussionCategory, draft, name, prerelease) {
create(tag, body, commitHash, draft, name, prerelease) {
return __awaiter(this, void 0, void 0, function* () {
// noinspection TypeScriptValidateJSTypes
return this.git.repos.createRelease({
body: body,
name: name,
discussion_category_name: discussionCategory,
draft: draft,
owner: this.inputs.owner,
prerelease: prerelease,
@@ -66,14 +65,13 @@ class GithubReleases {
});
});
}
update(id, tag, body, commitHash, discussionCategory, draft, name, prerelease) {
update(id, tag, body, commitHash, draft, name, prerelease) {
return __awaiter(this, void 0, void 0, function* () {
// noinspection TypeScriptValidateJSTypes
return this.git.repos.updateRelease({
release_id: id,
body: body,
name: name,
discussion_category_name: discussionCategory,
draft: draft,
owner: this.inputs.owner,
prerelease: prerelease,

View File

@@ -1,7 +1,7 @@
import {Inputs} from "./Inputs";
import {CreateReleaseResponse, ReleaseByTagResponse, Releases, UpdateReleaseResponse} from "./Releases";
import {CreateReleaseResponse, Releases, UpdateReleaseResponse} from "./Releases";
import {ArtifactUploader} from "./ArtifactUploader";
import {GithubError} from "./GithubError";
import {ErrorMessage} from "./ErrorMessage";
export class Action {
private inputs: Inputs
@@ -27,26 +27,20 @@ export class Action {
private async createOrUpdateRelease(): Promise<CreateReleaseResponse | UpdateReleaseResponse> {
if (this.inputs.allowUpdates) {
let getResponse: ReleaseByTagResponse
try {
getResponse = await this.releases.getByTag(this.inputs.tag)
const getResponse = await this.releases.getByTag(this.inputs.tag)
return await this.updateRelease(getResponse.data.id)
} catch (error) {
return await this.checkForMissingReleaseError(error)
if (Action.noPublishedRelease(error)) {
return await this.updateDraftOrCreateRelease()
} else {
throw error
}
}
return await this.updateRelease(getResponse.data.id)
} else {
return await this.createRelease()
}
}
private async checkForMissingReleaseError(error: Error) : Promise<CreateReleaseResponse | UpdateReleaseResponse> {
if (Action.noPublishedRelease(error)) {
return await this.updateDraftOrCreateRelease()
} else {
throw error
}
}
private async updateRelease(id: number): Promise<UpdateReleaseResponse> {
return await this.releases.update(
@@ -54,7 +48,6 @@ export class Action {
this.inputs.tag,
this.inputs.updatedReleaseBody,
this.inputs.commit,
this.inputs.discussionCategory,
this.inputs.draft,
this.inputs.updatedReleaseName,
this.inputs.prerelease
@@ -62,8 +55,8 @@ export class Action {
}
private static noPublishedRelease(error: any): boolean {
const githubError = new GithubError(error)
return githubError.status == 404
const errorMessage = new ErrorMessage(error)
return errorMessage.status == 404
}
private async updateDraftOrCreateRelease(): Promise<CreateReleaseResponse | UpdateReleaseResponse> {
@@ -85,14 +78,15 @@ export class Action {
}
private async createRelease(): Promise<CreateReleaseResponse> {
return await this.releases.create(
const response = await this.releases.create(
this.inputs.tag,
this.inputs.createdReleaseBody,
this.inputs.commit,
this.inputs.discussionCategory,
this.inputs.draft,
this.inputs.createdReleaseName,
this.inputs.prerelease
)
return response
}
}

View File

@@ -4,7 +4,7 @@ import {Artifact} from "./Artifact";
import untildify from "untildify";
export interface ArtifactGlobber {
globArtifactString(artifact: string, contentType: string, throwsWhenNoFiles: boolean): Artifact[]
globArtifactString(artifact: string, contentType: string): Artifact[]
}
export class FileArtifactGlobber implements ArtifactGlobber {
@@ -14,22 +14,18 @@ export class FileArtifactGlobber implements ArtifactGlobber {
this.globber = globber
}
globArtifactString(artifact: string, contentType: string, throwsWhenNoFiles: boolean): Artifact[] {
globArtifactString(artifact: string, contentType: string): Artifact[] {
return artifact.split(',')
.map(path => FileArtifactGlobber.expandPath(path))
.map(pattern => this.globPattern(pattern, throwsWhenNoFiles))
.map(pattern => this.globPattern(pattern))
.reduce((accumulated, current) => accumulated.concat(current))
.map(path => new Artifact(path, contentType))
}
private globPattern(pattern: string, throwsWhenNoFiles: boolean): string[] {
private globPattern(pattern: string): string[] {
const paths = this.globber.glob(pattern)
if (paths.length == 0) {
if (throwsWhenNoFiles) {
FileArtifactGlobber.throwGlobError(pattern)
} else {
FileArtifactGlobber.reportGlobWarning(pattern)
}
FileArtifactGlobber.reportGlobWarning(pattern)
}
return paths
}
@@ -38,10 +34,6 @@ export class FileArtifactGlobber implements ArtifactGlobber {
core.warning(`Artifact pattern :${pattern} did not match any files`)
}
private static throwGlobError(pattern: string) {
throw Error(`Artifact pattern :${pattern} did not match any files`)
}
private static expandPath(path: string): string {
return untildify(path)
}

View File

@@ -10,7 +10,6 @@ export class GithubArtifactUploader implements ArtifactUploader {
constructor(
private releases: Releases,
private replacesExistingArtifacts: boolean = true,
private throwsUploadErrors: boolean = false,
) {
}
@@ -42,11 +41,7 @@ export class GithubArtifactUploader implements ArtifactUploader {
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}. Retrying...`)
await this.uploadArtifact(artifact, releaseId, uploadUrl, retry - 1)
} else {
if (this.throwsUploadErrors) {
throw Error(`Failed to upload artifact ${artifact.name}. ${error.message}.`)
} else {
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}.`)
}
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}.`)
}
}
}

44
src/ErrorMessage.ts Normal file
View File

@@ -0,0 +1,44 @@
import {GithubError} from "./GithubError"
export class ErrorMessage {
private error: any
private githubErrors: GithubError[]
constructor(error: any) {
this.error = error
this.githubErrors = this.generateGithubErrors()
}
private generateGithubErrors(): GithubError[] {
const errors = this.error.errors
if (errors instanceof Array) {
return errors.map((err) => new GithubError(err))
} else {
return []
}
}
get status(): number {
return this.error.status
}
hasErrorWithCode(code: String): boolean {
return this.githubErrors.some((err) => err.code == code)
}
toString(): string {
const message = this.error.message
const errors = this.githubErrors
const status = this.status
if (errors.length > 0) {
return `Error ${status}: ${message}\nErrors:\n${this.errorBulletedList(errors)}`
} else {
return `Error ${status}: ${message}`
}
}
private errorBulletedList(errors: GithubError[]): string {
return errors.map((err) => `- ${err}`).join("\n")
}
}

View File

@@ -1,44 +1,65 @@
import {GithubErrorDetail} from "./GithubErrorDetail"
export class GithubError {
private error: any
private readonly githubErrors: GithubErrorDetail[]
private error: any;
constructor(error: any) {
this.error = error
this.githubErrors = this.generateGithubErrors()
}
private generateGithubErrors(): GithubErrorDetail[] {
const errors = this.error.errors
if (errors instanceof Array) {
return errors.map((err) => new GithubErrorDetail(err))
} else {
return []
}
}
get status(): number {
return this.error.status
}
hasErrorWithCode(code: String): boolean {
return this.githubErrors.some((err) => err.code == code)
get code(): string {
return this.error.code
}
toString(): string {
const message = this.error.message
const errors = this.githubErrors
const status = this.status
if (errors.length > 0) {
return `Error ${status}: ${message}\nErrors:\n${this.errorBulletedList(errors)}`
} else {
return `Error ${status}: ${message}`
const code = this.error.code
switch (code) {
case 'missing':
return this.missingResourceMessage()
case 'missing_field':
return this.missingFieldMessage()
case 'invalid':
return this.invalidFieldMessage()
case 'already_exists':
return this.resourceAlreadyExists()
default:
return this.customErrorMessage()
}
}
private errorBulletedList(errors: GithubErrorDetail[]): string {
return errors.map((err) => `- ${err}`).join("\n")
private customErrorMessage(): string {
const message = this.error.message;
const documentation = this.error.documentation_url
let documentationMessage: string
if (documentation) {
documentationMessage = `\nPlease see ${documentation}.`
} else {
documentationMessage = ""
}
return `${message}${documentationMessage}`
}
private invalidFieldMessage(): string {
const resource = this.error.resource
const field = this.error.field
return `The ${field} field on ${resource} is an invalid format.`
}
private missingResourceMessage(): string {
const resource = this.error.resource
return `${resource} does not exist.`
}
private missingFieldMessage(): string {
const resource = this.error.resource
const field = this.error.field
return `The ${field} field on ${resource} is missing.`
}
private resourceAlreadyExists(): string {
const resource = this.error.resource
return `${resource} already exists.`
}
}

View File

@@ -1,65 +0,0 @@
export class GithubErrorDetail {
private error: any;
constructor(error: any) {
this.error = error
}
get code(): string {
return this.error.code
}
toString(): string {
const code = this.error.code
switch (code) {
case 'missing':
return this.missingResourceMessage()
case 'missing_field':
return this.missingFieldMessage()
case 'invalid':
return this.invalidFieldMessage()
case 'already_exists':
return this.resourceAlreadyExists()
default:
return this.customErrorMessage()
}
}
private customErrorMessage(): string {
const message = this.error.message;
const documentation = this.error.documentation_url
let documentationMessage: string
if (documentation) {
documentationMessage = `\nPlease see ${documentation}.`
} else {
documentationMessage = ""
}
return `${message}${documentationMessage}`
}
private invalidFieldMessage(): string {
const resource = this.error.resource
const field = this.error.field
return `The ${field} field on ${resource} is an invalid format.`
}
private missingResourceMessage(): string {
const resource = this.error.resource
return `${resource} does not exist.`
}
private missingFieldMessage(): string {
const resource = this.error.resource
const field = this.error.field
return `The ${field} field on ${resource} is missing.`
}
private resourceAlreadyExists(): string {
const resource = this.error.resource
return `${resource} already exists.`
}
}

View File

@@ -6,12 +6,10 @@ import {Artifact} from './Artifact';
export interface Inputs {
readonly allowUpdates: boolean
readonly artifactErrorsFailBuild: boolean
readonly artifacts: Artifact[]
readonly commit: string
readonly createdReleaseBody?: string
readonly createdReleaseName?: string
readonly discussionCategory?: string
readonly draft: boolean
readonly owner: string
readonly prerelease: boolean
@@ -48,16 +46,11 @@ export class CoreInputs implements Inputs {
contentType = 'raw'
}
return this.artifactGlobber
.globArtifactString(artifacts, contentType, this.artifactErrorsFailBuild)
.globArtifactString(artifacts, contentType)
}
return []
}
get artifactErrorsFailBuild(): boolean {
const allow = core.getInput('artifactErrorsFailBuild')
return allow == 'true'
}
get createdReleaseBody(): string | undefined {
if (CoreInputs.omitBody) return undefined
return this.body
@@ -67,7 +60,7 @@ export class CoreInputs implements Inputs {
return core.getInput('omitBody') == 'true'
}
private get body(): string | undefined {
private get body() : string | undefined {
const body = core.getInput('body')
if (body) {
return body
@@ -90,14 +83,6 @@ export class CoreInputs implements Inputs {
return this.name
}
get discussionCategory(): string | undefined {
const category = core.getInput('discussionCategory')
if (category) {
return category
}
return undefined
}
private static get omitName(): boolean {
return core.getInput('omitName') == 'true'
}
@@ -171,7 +156,7 @@ export class CoreInputs implements Inputs {
}
get updatedReleaseName(): string | undefined {
if (CoreInputs.omitName || CoreInputs.omitNameDuringUpdate) return undefined
if (CoreInputs.omitName || CoreInputs.omitNameDuringUpdate) return undefined
return this.name
}

View File

@@ -5,15 +5,15 @@ import { GithubReleases } from './Releases';
import { Action } from './Action';
import { GithubArtifactUploader } from './ArtifactUploader';
import { FileArtifactGlobber } from './ArtifactGlobber';
import { GithubError } from './GithubError';
import { ErrorMessage } from './ErrorMessage';
async function run() {
try {
const action = createAction()
await action.perform()
} catch (error) {
const githubError = new GithubError(error)
core.setFailed(githubError.toString());
const errorMessage = new ErrorMessage(error)
core.setFailed(errorMessage.toString());
}
}
@@ -25,7 +25,7 @@ function createAction(): Action {
const inputs = new CoreInputs(globber, context)
const releases = new GithubReleases(inputs, git)
const uploader = new GithubArtifactUploader(releases, inputs.replacesArtifacts, inputs.artifactErrorsFailBuild)
const uploader = new GithubArtifactUploader(releases, inputs.replacesArtifacts)
return new Action(inputs, releases, uploader)
}

View File

@@ -15,7 +15,6 @@ export interface Releases {
tag: string,
body?: string,
commitHash?: string,
discussionCategory?: string,
draft?: boolean,
name?: string,
prerelease?: boolean
@@ -34,7 +33,6 @@ export interface Releases {
tag: string,
body?: string,
commitHash?: string,
discussionCategory?: string,
draft?: boolean,
name?: string,
prerelease?: boolean
@@ -63,7 +61,6 @@ export class GithubReleases implements Releases {
tag: string,
body?: string,
commitHash?: string,
discussionCategory?: string,
draft?: boolean,
name?: string,
prerelease?: boolean
@@ -72,7 +69,6 @@ export class GithubReleases implements Releases {
return this.git.repos.createRelease({
body: body,
name: name,
discussion_category_name: discussionCategory,
draft: draft,
owner: this.inputs.owner,
prerelease: prerelease,
@@ -122,7 +118,6 @@ export class GithubReleases implements Releases {
tag: string,
body?: string,
commitHash?: string,
discussionCategory?: string,
draft?: boolean,
name?: string,
prerelease?: boolean
@@ -132,7 +127,6 @@ export class GithubReleases implements Releases {
release_id: id,
body: body,
name: name,
discussion_category_name: discussionCategory,
draft: draft,
owner: this.inputs.owner,
prerelease: prerelease,