From f7099b1a080022b7bdd83fe122ff95f7bcd806b0 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Sat, 9 May 2020 11:19:13 +0900 Subject: [PATCH 1/8] refactor: inject inputs to run() --- src/inputs.ts | 34 ++++++++++++++++++++++++++++++++++ src/main.ts | 26 ++++++++++++-------------- 2 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 src/inputs.ts diff --git a/src/inputs.ts b/src/inputs.ts new file mode 100644 index 00000000..60be4a7f --- /dev/null +++ b/src/inputs.ts @@ -0,0 +1,34 @@ +import * as core from '@actions/core' + +// Why use function rather than raw string? => Inputs should be lazy evaluated. +export interface Inputs { + publishDir(): string + deployMessage(): string | undefined + productionBranch(): string | undefined + enablePullRequestComment(): boolean + enableCommitComment(): boolean + githubToken(): string +} + +export const defaultInputs: Inputs = { + publishDir() { + return core.getInput('publish-dir', {required: true}) + }, + deployMessage() { + return core.getInput('deploy-message') || undefined + }, + productionBranch() { + return core.getInput('production-branch') || undefined + }, + enablePullRequestComment() { + // Default: true + return (core.getInput('enable-pull-request-comment') || 'true') === 'true' + }, + enableCommitComment() { + // Default: true + return (core.getInput('enable-commit-comment') || 'true') === 'true' + }, + githubToken() { + return core.getInput('github-token') + } +} diff --git a/src/main.ts b/src/main.ts index d02d1057..75dbb2b1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,8 +2,9 @@ import * as core from '@actions/core' import {context, GitHub} from '@actions/github' import NetlifyAPI from 'netlify' import * as path from 'path' +import {defaultInputs, Inputs} from './inputs' -async function run(): Promise { +async function run(inputs: Inputs): Promise { try { const netlifyAuthToken = process.env.NETLIFY_AUTH_TOKEN const siteId = process.env.NETLIFY_SITE_ID @@ -12,17 +13,14 @@ async function run(): Promise { process.stdout.write('Netlify credentials not provided, not deployable') return } - const dir = core.getInput('publish-dir', {required: true}) - const deployMessage = core.getInput('deploy-message') || undefined - const productionBranch = core.getInput('production-branch') - // Default: true - const enablePullRequestComment: boolean = - (core.getInput('enable-pull-request-comment') || 'true') === 'true' - // Default: true - const enableCommitComment: boolean = - (core.getInput('enable-commit-comment') || 'true') === 'true' - // NOTE: if production-branch is not specified, it is "", so isDraft is always true - const isDraft: boolean = context.ref !== `refs/heads/${productionBranch}` + const dir = inputs.publishDir() + const deployMessage: string | undefined = inputs.deployMessage() + const productionBranch: string | undefined = inputs.productionBranch() + const enablePullRequestComment: boolean = inputs.enablePullRequestComment() + const enableCommitComment: boolean = inputs.enableCommitComment() + const isDraft: boolean = + productionBranch === undefined || + context.ref !== `refs/heads/${productionBranch}` // Create Netlify API client const netlifyClient = new NetlifyAPI(netlifyAuthToken) @@ -47,7 +45,7 @@ async function run(): Promise { ) // Get GitHub token - const githubToken = core.getInput('github-token') + const githubToken = inputs.githubToken() if (githubToken !== '') { // Create GitHub client const githubClient = new GitHub(githubToken) @@ -88,4 +86,4 @@ async function run(): Promise { } } -run() +run(defaultInputs) From d66b42fc8bfc69c63e8e57d12c1792dea38ab1a6 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Sun, 10 May 2020 10:09:55 +0900 Subject: [PATCH 2/8] test: test defaultInputs --- __tests__/main.test.ts | 113 +++++++++++++++++++++++++++++++++++++++++ dist/index.js | 63 ++++++++++++++++++----- 2 files changed, 163 insertions(+), 13 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index ede47523..a5d8f712 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -2,6 +2,119 @@ import {wait} from '../src/wait' import * as process from 'process' import * as cp from 'child_process' import * as path from 'path' +import {defaultInputs} from '../src/inputs' + +/** + * With input + * @param inputName + * @param value + * @param f + */ +export async function withInput(inputName: string, value: string, f: () => void | Promise): Promise { + // (from: https://github.com/actions/toolkit/blob/83dd3ef0f1e5bc93c5ab7072e1edf1715a01ba9d/packages/core/src/core.ts#L71) + const envName = `INPUT_${inputName.replace(/ /g, '_').toUpperCase()}` + process.env[envName] = value + await f(); + // NOTE: Not sure this is correct deletion + delete process.env[envName] +} + +describe('defaultInputs', () => { + test('publishDir', () => { + withInput('publish-dir', './my_publish_dir', () => { + const publishDir: string = defaultInputs.publishDir() + expect(publishDir).toBe('./my_publish_dir') + }); + }) + + + describe('deployMessage', () => { + test('it should be a string when specified', () => { + withInput('deploy-message', 'Deploy with GitHub Actions', () => { + const deployMessage: string | undefined = defaultInputs.deployMessage() + expect(deployMessage).toBe('Deploy with GitHub Actions') + }); + }); + + test('it should be undefined when not specified', () => { + const deployMessage: string | undefined = defaultInputs.deployMessage() + expect(deployMessage).toBe(undefined) + }); + }); + + describe('productionBranch', () => { + test('it should be a string when specified', () => { + withInput('production-branch', 'master', () => { + const productionBranch: string | undefined = defaultInputs.productionBranch() + expect(productionBranch).toBe('master') + }); + }); + + test('it should be undefined when not specified', () => { + const deployMessage: string | undefined = defaultInputs.productionBranch() + expect(deployMessage).toBe(undefined) + }); + }); + + describe('enablePullRequestComment', () => { + test('it should be default value (true) when not specified', () => { + const b: boolean = defaultInputs.enablePullRequestComment() + expect(b).toBe(true) + }); + + test('it should be true when "true" specified', () => { + withInput('enable-pull-request-comment', 'true', () => { + const b: boolean = defaultInputs.enablePullRequestComment() + expect(b).toBe(true) + }); + }); + + test('it should be true when "false" specified', () => { + withInput('enable-pull-request-comment', 'false', () => { + const b: boolean = defaultInputs.enablePullRequestComment() + expect(b).toBe(false) + }); + }); + }); + + describe('enableCommitComment', () => { + test('it should be default value (true) when not specified', () => { + const b: boolean = defaultInputs.enableCommitComment() + expect(b).toBe(true) + }); + + test('it should be true when "true" specified', () => { + withInput('enable-commit-comment', 'true', () => { + const b: boolean = defaultInputs.enableCommitComment() + expect(b).toBe(true) + }); + }); + + test('it should be true when "false" specified', () => { + withInput('enable-commit-comment', 'false', () => { + const b: boolean = defaultInputs.enableCommitComment() + expect(b).toBe(false) + }); + }); + }); + + describe('enableCommitComment', () => { + test('it should be empty string when not specified', () => { + const t: string = defaultInputs.githubToken() + expect(t).toBe('') + }); + + test('it should be a string when specified', () => { + withInput('github-token', 'DUMMY_GITHUB_TOKEN', () => { + const t: string = defaultInputs.githubToken() + expect(t).toBe('DUMMY_GITHUB_TOKEN') + }); + }); + }); +}) + + +// Old tests below test('throws invalid number', async () => { const input = parseInt('foo', 10) diff --git a/dist/index.js b/dist/index.js index 1e5f876c..d6116b40 100644 --- a/dist/index.js +++ b/dist/index.js @@ -41876,7 +41876,8 @@ const core = __importStar(__webpack_require__(470)); const github_1 = __webpack_require__(469); const netlify_1 = __importDefault(__webpack_require__(326)); const path = __importStar(__webpack_require__(622)); -function run() { +const inputs_1 = __webpack_require__(840); +function run(inputs) { return __awaiter(this, void 0, void 0, function* () { try { const netlifyAuthToken = process.env.NETLIFY_AUTH_TOKEN; @@ -41886,15 +41887,13 @@ function run() { process.stdout.write('Netlify credentials not provided, not deployable'); return; } - const dir = core.getInput('publish-dir', { required: true }); - const deployMessage = core.getInput('deploy-message') || undefined; - const productionBranch = core.getInput('production-branch'); - // Default: true - const enablePullRequestComment = (core.getInput('enable-pull-request-comment') || 'true') === 'true'; - // Default: true - const enableCommitComment = (core.getInput('enable-commit-comment') || 'true') === 'true'; - // NOTE: if production-branch is not specified, it is "", so isDraft is always true - const isDraft = github_1.context.ref !== `refs/heads/${productionBranch}`; + const dir = inputs.publishDir(); + const deployMessage = inputs.deployMessage(); + const productionBranch = inputs.productionBranch(); + const enablePullRequestComment = inputs.enablePullRequestComment(); + const enableCommitComment = inputs.enableCommitComment(); + const isDraft = productionBranch === undefined || + github_1.context.ref !== `refs/heads/${productionBranch}`; // Create Netlify API client const netlifyClient = new netlify_1.default(netlifyAuthToken); // Resolve publish directory @@ -41913,7 +41912,7 @@ function run() { // Set the deploy URL to outputs for GitHub Actions core.setOutput('deploy-url', isDraft ? deploy.deploy.deploy_ssl_url : deploy.deploy.ssl_url); // Get GitHub token - const githubToken = core.getInput('github-token'); + const githubToken = inputs.githubToken(); if (githubToken !== '') { // Create GitHub client const githubClient = new github_1.GitHub(githubToken); @@ -41954,7 +41953,7 @@ function run() { } }); } -run(); +run(inputs_1.defaultInputs); /***/ }), @@ -245551,7 +245550,45 @@ exports.ArraySet = ArraySet; /***/ }), /* 839 */, -/* 840 */, +/* 840 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const core = __importStar(__webpack_require__(470)); +exports.defaultInputs = { + publishDir() { + return core.getInput('publish-dir', { required: true }); + }, + deployMessage() { + return core.getInput('deploy-message') || undefined; + }, + productionBranch() { + return core.getInput('production-branch') || undefined; + }, + enablePullRequestComment() { + // Default: true + return (core.getInput('enable-pull-request-comment') || 'true') === 'true'; + }, + enableCommitComment() { + // Default: true + return (core.getInput('enable-commit-comment') || 'true') === 'true'; + }, + githubToken() { + return core.getInput('github-token'); + } +}; + + +/***/ }), /* 841 */, /* 842 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { From 83e878e5d3f6b6ea0b5883f0acac082f1739b866 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Sun, 10 May 2020 11:43:59 +0900 Subject: [PATCH 3/8] feat: add "overwrites-pull-request-comment" input --- __tests__/main.test.ts | 64 ++++++++++++++++++++++-------------------- action.yml | 3 ++ dist/index.js | 46 ++++++++++++++++++++++++++++-- src/inputs.ts | 7 +++++ src/main.ts | 49 ++++++++++++++++++++++++++++++-- 5 files changed, 135 insertions(+), 34 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index a5d8f712..c45ad436 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -10,11 +10,15 @@ import {defaultInputs} from '../src/inputs' * @param value * @param f */ -export async function withInput(inputName: string, value: string, f: () => void | Promise): Promise { +export async function withInput( + inputName: string, + value: string, + f: () => void | Promise +): Promise { // (from: https://github.com/actions/toolkit/blob/83dd3ef0f1e5bc93c5ab7072e1edf1715a01ba9d/packages/core/src/core.ts#L71) const envName = `INPUT_${inputName.replace(/ /g, '_').toUpperCase()}` process.env[envName] = value - await f(); + await f() // NOTE: Not sure this is correct deletion delete process.env[envName] } @@ -24,96 +28,96 @@ describe('defaultInputs', () => { withInput('publish-dir', './my_publish_dir', () => { const publishDir: string = defaultInputs.publishDir() expect(publishDir).toBe('./my_publish_dir') - }); + }) }) - describe('deployMessage', () => { test('it should be a string when specified', () => { withInput('deploy-message', 'Deploy with GitHub Actions', () => { const deployMessage: string | undefined = defaultInputs.deployMessage() expect(deployMessage).toBe('Deploy with GitHub Actions') - }); - }); + }) + }) test('it should be undefined when not specified', () => { const deployMessage: string | undefined = defaultInputs.deployMessage() expect(deployMessage).toBe(undefined) - }); - }); + }) + }) describe('productionBranch', () => { test('it should be a string when specified', () => { withInput('production-branch', 'master', () => { - const productionBranch: string | undefined = defaultInputs.productionBranch() + const productionBranch: + | string + | undefined = defaultInputs.productionBranch() expect(productionBranch).toBe('master') - }); - }); + }) + }) test('it should be undefined when not specified', () => { const deployMessage: string | undefined = defaultInputs.productionBranch() expect(deployMessage).toBe(undefined) - }); - }); + }) + }) describe('enablePullRequestComment', () => { test('it should be default value (true) when not specified', () => { const b: boolean = defaultInputs.enablePullRequestComment() expect(b).toBe(true) - }); + }) test('it should be true when "true" specified', () => { withInput('enable-pull-request-comment', 'true', () => { const b: boolean = defaultInputs.enablePullRequestComment() expect(b).toBe(true) - }); - }); + }) + }) test('it should be true when "false" specified', () => { withInput('enable-pull-request-comment', 'false', () => { const b: boolean = defaultInputs.enablePullRequestComment() expect(b).toBe(false) - }); - }); - }); + }) + }) + }) describe('enableCommitComment', () => { test('it should be default value (true) when not specified', () => { const b: boolean = defaultInputs.enableCommitComment() expect(b).toBe(true) - }); + }) test('it should be true when "true" specified', () => { withInput('enable-commit-comment', 'true', () => { const b: boolean = defaultInputs.enableCommitComment() expect(b).toBe(true) - }); - }); + }) + }) test('it should be true when "false" specified', () => { withInput('enable-commit-comment', 'false', () => { const b: boolean = defaultInputs.enableCommitComment() expect(b).toBe(false) - }); - }); - }); + }) + }) + }) describe('enableCommitComment', () => { test('it should be empty string when not specified', () => { const t: string = defaultInputs.githubToken() expect(t).toBe('') - }); + }) test('it should be a string when specified', () => { withInput('github-token', 'DUMMY_GITHUB_TOKEN', () => { const t: string = defaultInputs.githubToken() expect(t).toBe('DUMMY_GITHUB_TOKEN') - }); - }); - }); + }) + }) + }) }) - // Old tests below test('throws invalid number', async () => { diff --git a/action.yml b/action.yml index 6a7c42a5..4b2f2e32 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,9 @@ inputs: enable-commit-comment: description: Enable commit comment required: false + overwrites-pull-request-comment: + description: Overwrites pull request comment + required: false outputs: deploy-url: description: Deploy URL diff --git a/dist/index.js b/dist/index.js index d6116b40..a2e2535c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -41877,6 +41877,25 @@ const github_1 = __webpack_require__(469); const netlify_1 = __importDefault(__webpack_require__(326)); const path = __importStar(__webpack_require__(622)); const inputs_1 = __webpack_require__(840); +const commentIdentifierString = ''; +function findIssueComment(githubClient) { + return __awaiter(this, void 0, void 0, function* () { + const listCommentsRes = yield githubClient.issues.listComments({ + owner: github_1.context.issue.owner, + repo: github_1.context.issue.repo, + // eslint-disable-next-line @typescript-eslint/camelcase + issue_number: github_1.context.issue.number + }); + const comments = listCommentsRes.data; + for (const comment of comments) { + // If comment contains the comment identifier + if (comment.body.includes(commentIdentifierString)) { + return comment.id; + } + } + return undefined; + }); +} function run(inputs) { return __awaiter(this, void 0, void 0, function* () { try { @@ -41892,6 +41911,7 @@ function run(inputs) { const productionBranch = inputs.productionBranch(); const enablePullRequestComment = inputs.enablePullRequestComment(); const enableCommitComment = inputs.enableCommitComment(); + const overwritesPullRequestComment = inputs.overwritesPullRequestComment(); const isDraft = productionBranch === undefined || github_1.context.ref !== `refs/heads/${productionBranch}`; // Create Netlify API client @@ -41914,6 +41934,7 @@ function run(inputs) { // Get GitHub token const githubToken = inputs.githubToken(); if (githubToken !== '') { + const markdownComment = `${commentIdentifierString}\n${message}`; // Create GitHub client const githubClient = new github_1.GitHub(githubToken); if (enableCommitComment) { @@ -41922,7 +41943,7 @@ function run(inputs) { repo: github_1.context.repo.repo, // eslint-disable-next-line @typescript-eslint/camelcase commit_sha: github_1.context.sha, - body: message + body: markdownComment }; // TODO: Remove try // NOTE: try-catch is experimentally used because commit message may not be done in some conditions. @@ -41937,13 +41958,30 @@ function run(inputs) { } // If it is a pull request and enable comment on pull request if (github_1.context.issue.number !== undefined && enablePullRequestComment) { + let commentId = undefined; + if (overwritesPullRequestComment) { + // Find issue comment + commentId = yield findIssueComment(githubClient); + } + // NOTE: if not overwrite, commentId is always undefined + if (commentId !== undefined) { + // Update comment of the deploy URL + yield githubClient.issues.updateComment({ + owner: github_1.context.issue.owner, + repo: github_1.context.issue.repo, + // eslint-disable-next-line @typescript-eslint/camelcase + comment_id: commentId, + body: markdownComment + }); + return; + } // Comment the deploy URL yield githubClient.issues.createComment({ // eslint-disable-next-line @typescript-eslint/camelcase issue_number: github_1.context.issue.number, owner: github_1.context.repo.owner, repo: github_1.context.repo.repo, - body: message + body: markdownComment }); } } @@ -245584,6 +245622,10 @@ exports.defaultInputs = { }, githubToken() { return core.getInput('github-token'); + }, + overwritesPullRequestComment() { + // Default: true + return ((core.getInput('overwrites-pull-request-comment') || 'true') === 'true'); } }; diff --git a/src/inputs.ts b/src/inputs.ts index 60be4a7f..964f76d1 100644 --- a/src/inputs.ts +++ b/src/inputs.ts @@ -8,6 +8,7 @@ export interface Inputs { enablePullRequestComment(): boolean enableCommitComment(): boolean githubToken(): string + overwritesPullRequestComment(): boolean } export const defaultInputs: Inputs = { @@ -30,5 +31,11 @@ export const defaultInputs: Inputs = { }, githubToken() { return core.getInput('github-token') + }, + overwritesPullRequestComment() { + // Default: true + return ( + (core.getInput('overwrites-pull-request-comment') || 'true') === 'true' + ) } } diff --git a/src/main.ts b/src/main.ts index 75dbb2b1..427fc7aa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,29 @@ import NetlifyAPI from 'netlify' import * as path from 'path' import {defaultInputs, Inputs} from './inputs' +const commentIdentifierString = + '' + +async function findIssueComment( + githubClient: GitHub +): Promise { + const listCommentsRes = await githubClient.issues.listComments({ + owner: context.issue.owner, + repo: context.issue.repo, + // eslint-disable-next-line @typescript-eslint/camelcase + issue_number: context.issue.number + }) + + const comments = listCommentsRes.data + for (const comment of comments) { + // If comment contains the comment identifier + if (comment.body.includes(commentIdentifierString)) { + return comment.id + } + } + return undefined +} + async function run(inputs: Inputs): Promise { try { const netlifyAuthToken = process.env.NETLIFY_AUTH_TOKEN @@ -18,6 +41,7 @@ async function run(inputs: Inputs): Promise { const productionBranch: string | undefined = inputs.productionBranch() const enablePullRequestComment: boolean = inputs.enablePullRequestComment() const enableCommitComment: boolean = inputs.enableCommitComment() + const overwritesPullRequestComment: boolean = inputs.overwritesPullRequestComment() const isDraft: boolean = productionBranch === undefined || context.ref !== `refs/heads/${productionBranch}` @@ -47,6 +71,8 @@ async function run(inputs: Inputs): Promise { // Get GitHub token const githubToken = inputs.githubToken() if (githubToken !== '') { + const markdownComment = `${commentIdentifierString}\n${message}` + // Create GitHub client const githubClient = new GitHub(githubToken) @@ -56,7 +82,7 @@ async function run(inputs: Inputs): Promise { repo: context.repo.repo, // eslint-disable-next-line @typescript-eslint/camelcase commit_sha: context.sha, - body: message + body: markdownComment } // TODO: Remove try // NOTE: try-catch is experimentally used because commit message may not be done in some conditions. @@ -71,13 +97,32 @@ async function run(inputs: Inputs): Promise { // If it is a pull request and enable comment on pull request if (context.issue.number !== undefined && enablePullRequestComment) { + let commentId: number | undefined = undefined + if (overwritesPullRequestComment) { + // Find issue comment + commentId = await findIssueComment(githubClient) + } + + // NOTE: if not overwrite, commentId is always undefined + if (commentId !== undefined) { + // Update comment of the deploy URL + await githubClient.issues.updateComment({ + owner: context.issue.owner, + repo: context.issue.repo, + // eslint-disable-next-line @typescript-eslint/camelcase + comment_id: commentId, + body: markdownComment + }) + return + } + // Comment the deploy URL await githubClient.issues.createComment({ // eslint-disable-next-line @typescript-eslint/camelcase issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: message + body: markdownComment }) } } From 04eecc1b02a3b4a76dc2783fd592c53f7cc0abe4 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Sun, 10 May 2020 11:57:41 +0900 Subject: [PATCH 4/8] test: input test for overwritesPullRequestComment() --- __tests__/main.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index c45ad436..6ba2b688 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -116,6 +116,27 @@ describe('defaultInputs', () => { }) }) }) + + describe('overwritesPullRequestComment', () => { + test('it should be default value (true) when not specified', () => { + const b: boolean = defaultInputs.overwritesPullRequestComment() + expect(b).toBe(true) + }) + + test('it should be true when "true" specified', () => { + withInput('overwrites-pull-request-comment', 'true', () => { + const b: boolean = defaultInputs.overwritesPullRequestComment() + expect(b).toBe(true) + }) + }) + + test('it should be true when "false" specified', () => { + withInput('overwrites-pull-request-comment', 'false', () => { + const b: boolean = defaultInputs.overwritesPullRequestComment() + expect(b).toBe(false) + }) + }) + }) }) // Old tests below From 5af259887cf2ab88e4b5607ac75fed4c81f5d198 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 10 May 2020 12:18:24 +0900 Subject: [PATCH 5/8] chore(deps-dev): bump ts-jest from 25.5.0 to 25.5.1 (#136) Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 25.5.0 to 25.5.1. - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/kulshekhar/ts-jest/compare/v25.5.0...v25.5.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index cd30e821..cfdc2dcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8700,9 +8700,9 @@ } }, "ts-jest": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.5.0.tgz", - "integrity": "sha512-govrjbOk1UEzcJ5cX5k8X8IUtFuP3lp3mrF3ZuKtCdAOQzdeCM7qualhb/U8s8SWFwEDutOqfF5PLkJ+oaYD4w==", + "version": "25.5.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.5.1.tgz", + "integrity": "sha512-kHEUlZMK8fn8vkxDjwbHlxXRB9dHYpyzqKIGDNxbzs+Rz+ssNDSDNusEK8Fk/sDd4xE6iKoQLfFkFVaskmTJyw==", "dev": true, "requires": { "bs-logger": "0.x", diff --git a/package.json b/package.json index af6d396a..8b53657f 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "jest-circus": "^26.0.1", "js-yaml": "^3.13.1", "prettier": "^2.0.5", - "ts-jest": "^25.5.0", + "ts-jest": "^25.5.1", "typescript": "^3.8.3" } } From f37b5c6dcd7e06e811d746683ba75d20d151a1d1 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Sun, 10 May 2020 12:22:18 +0900 Subject: [PATCH 6/8] chore: update dist/index.js --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index a2e2535c..1eff73d4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -75520,7 +75520,7 @@ module.exports = setup; /* 487 */ /***/ (function(module) { -module.exports = {"_from":"@typescript-eslint/typescript-estree@2.31.0","_id":"@typescript-eslint/typescript-estree@2.31.0","_inBundle":false,"_integrity":"sha512-vxW149bXFXXuBrAak0eKHOzbcu9cvi6iNcJDzEtOkRwGHxJG15chiAQAwhLOsk+86p9GTr/TziYvw+H9kMaIgA==","_location":"/@typescript-eslint/typescript-estree","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"@typescript-eslint/typescript-estree@2.31.0","name":"@typescript-eslint/typescript-estree","escapedName":"@typescript-eslint%2ftypescript-estree","scope":"@typescript-eslint","rawSpec":"2.31.0","saveSpec":null,"fetchSpec":"2.31.0"},"_requiredBy":["/@typescript-eslint/experimental-utils","/@typescript-eslint/parser","/detective-typescript"],"_resolved":"https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.31.0.tgz","_shasum":"ac536c2d46672aa1f27ba0ec2140d53670635cfd","_spec":"@typescript-eslint/typescript-estree@2.31.0","_where":"/Users/ryo/dev/actions/actions-netlify/node_modules/@typescript-eslint/parser","bugs":{"url":"https://github.com/typescript-eslint/typescript-eslint/issues"},"bundleDependencies":false,"dependencies":{"debug":"^4.1.1","eslint-visitor-keys":"^1.1.0","glob":"^7.1.6","is-glob":"^4.0.1","lodash":"^4.17.15","semver":"^6.3.0","tsutils":"^3.17.1"},"deprecated":false,"description":"A parser that converts TypeScript source code into an ESTree compatible form","devDependencies":{"@babel/code-frame":"^7.8.3","@babel/parser":"^7.8.3","@babel/types":"^7.8.3","@types/babel__code-frame":"^7.0.1","@types/debug":"^4.1.5","@types/glob":"^7.1.1","@types/is-glob":"^4.0.1","@types/lodash":"^4.14.149","@types/semver":"^6.2.0","@types/tmp":"^0.1.0","@typescript-eslint/shared-fixtures":"2.31.0","tmp":"^0.1.0","typescript":"*"},"engines":{"node":"^8.10.0 || ^10.13.0 || >=11.10.1"},"files":["dist","README.md","LICENSE"],"funding":{"type":"opencollective","url":"https://opencollective.com/typescript-eslint"},"gitHead":"176054c2171b682217d6855208e50b15e1712675","homepage":"https://github.com/typescript-eslint/typescript-eslint#readme","keywords":["ast","estree","ecmascript","javascript","typescript","parser","syntax"],"license":"BSD-2-Clause","main":"dist/parser.js","name":"@typescript-eslint/typescript-estree","peerDependenciesMeta":{"typescript":{"optional":true}},"repository":{"type":"git","url":"git+https://github.com/typescript-eslint/typescript-eslint.git","directory":"packages/typescript-estree"},"scripts":{"build":"tsc -b tsconfig.build.json","clean":"tsc -b tsconfig.build.json --clean","format":"prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore","lint":"eslint . --ext .js,.ts --ignore-path='../../.eslintignore'","test":"jest --coverage","typecheck":"tsc -p tsconfig.json --noEmit"},"types":"dist/parser.d.ts","version":"2.31.0"}; +module.exports = {"name":"@typescript-eslint/typescript-estree","version":"2.31.0","description":"A parser that converts TypeScript source code into an ESTree compatible form","main":"dist/parser.js","types":"dist/parser.d.ts","files":["dist","README.md","LICENSE"],"engines":{"node":"^8.10.0 || ^10.13.0 || >=11.10.1"},"repository":{"type":"git","url":"https://github.com/typescript-eslint/typescript-eslint.git","directory":"packages/typescript-estree"},"bugs":{"url":"https://github.com/typescript-eslint/typescript-eslint/issues"},"license":"BSD-2-Clause","keywords":["ast","estree","ecmascript","javascript","typescript","parser","syntax"],"scripts":{"build":"tsc -b tsconfig.build.json","clean":"tsc -b tsconfig.build.json --clean","format":"prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore","lint":"eslint . --ext .js,.ts --ignore-path='../../.eslintignore'","test":"jest --coverage","typecheck":"tsc -p tsconfig.json --noEmit"},"dependencies":{"debug":"^4.1.1","eslint-visitor-keys":"^1.1.0","glob":"^7.1.6","is-glob":"^4.0.1","lodash":"^4.17.15","semver":"^6.3.0","tsutils":"^3.17.1"},"devDependencies":{"@babel/code-frame":"^7.8.3","@babel/parser":"^7.8.3","@babel/types":"^7.8.3","@types/babel__code-frame":"^7.0.1","@types/debug":"^4.1.5","@types/glob":"^7.1.1","@types/is-glob":"^4.0.1","@types/lodash":"^4.14.149","@types/semver":"^6.2.0","@types/tmp":"^0.1.0","@typescript-eslint/shared-fixtures":"2.31.0","tmp":"^0.1.0","typescript":"*"},"peerDependenciesMeta":{"typescript":{"optional":true}},"funding":{"type":"opencollective","url":"https://opencollective.com/typescript-eslint"},"gitHead":"176054c2171b682217d6855208e50b15e1712675","_resolved":"https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.31.0.tgz","_integrity":"sha512-vxW149bXFXXuBrAak0eKHOzbcu9cvi6iNcJDzEtOkRwGHxJG15chiAQAwhLOsk+86p9GTr/TziYvw+H9kMaIgA==","_from":"@typescript-eslint/typescript-estree@2.31.0"}; /***/ }), /* 488 */ From f73ea0050f0081b4c9ab4b5a5cfe3b0363a7c849 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Sun, 10 May 2020 12:28:16 +0900 Subject: [PATCH 7/8] docs: write about `overwrites-pull-request-commen` and others --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 665d791b..c89ee57f 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,15 @@ jobs: # ... - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v1.0 + uses: nwtgck/actions-netlify@v1.1 with: publish-dir: './dist' production-branch: master github-token: ${{ secrets.GITHUB_TOKEN }} deploy-message: "Deploy from GitHub Actions" + enable-pull-request-comment: true + enable-commit-comment: true + overwrites-pull-request-comment: true env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} @@ -49,7 +52,8 @@ jobs: - `github-token: ${{ secrets.GITHUB_TOKEN }}` - `deploy-message` A custom deploy message to see on Netlify deployment (e.g. `${{ github.event.pull_request.title }}`) - `enable-pull-request-comment: true` Comment on pull request (default: true) -- `enable-commit-comment: true` Comment on GitHub commit (default) +- `enable-commit-comment: true` Comment on GitHub commit (default: true) +- `overwrites-pull-request-comment: true` Overwirtes comment on pull request (default: true) ### Outputs - `deploy-url` A deployment URL generated by Netlify From 27df0f764cd283fe5d40e9588d76441ede67145b Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Sun, 10 May 2020 12:36:14 +0900 Subject: [PATCH 8/8] bump: 1.1.0 --- CHANGELOG.md | 12 +++++++++++- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3bd312..26ad82b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) ## [Unreleased] +## [1.1.0] - 2020-05-10 +## Added +* Add "overwrites-pull-request-comment" input + +### Changed +* Overwrite comment on pull request by default + - You can use `overwrites-pull-request-comment: false` not to overwrite +* Update dependencies + ## [1.0.13] - 2020-05-09 ### Changed * Update dependencies @@ -86,7 +95,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) * Deploy to Netlify * Comment on GitHub PR -[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.0.13...HEAD +[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.1.0...HEAD +[1.1.0]: https://github.com/nwtgck/actions-netlify/compare/v1.0.13...v1.1.0 [1.0.13]: https://github.com/nwtgck/actions-netlify/compare/v1.0.12...v1.0.13 [1.0.12]: https://github.com/nwtgck/actions-netlify/compare/v1.0.11...v1.0.12 [1.0.11]: https://github.com/nwtgck/actions-netlify/compare/v1.0.10...v1.0.11 diff --git a/package-lock.json b/package-lock.json index cfdc2dcd..a38dd045 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "actions-netlify", - "version": "1.0.13", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8b53657f..76bb330b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "actions-netlify", - "version": "1.0.13", + "version": "1.1.0", "private": true, "description": "GitHub Actions for Netlify", "main": "lib/main.js",