From 47fa3e9292650e81bfb536fa39fa502a1af1b75d Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Fri, 21 Aug 2020 22:12:26 +0900 Subject: [PATCH 1/2] feat: add "enable-commit-status" input --- README.md | 1 + action.yml | 3 +++ dist/index.js | 36 +++++++++++++++++++++--------------- src/inputs.ts | 5 +++++ src/main.ts | 30 ++++++++++++++++-------------- 5 files changed, 46 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index f911688a..2abae1cb 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ jobs: - `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: true) +- `enable-commit-status: true` GitHub commit status (default: true) - `overwrites-pull-request-comment: true` Overwrites comment on pull request (default: true) - `netlify-config-path: ./netlify.toml` Path to `netlify.toml` (default: undefined) - `functions-dir` Netlify functions output directory (default: undefined) diff --git a/action.yml b/action.yml index 5298fea6..40f1d380 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,9 @@ inputs: enable-commit-comment: description: Enable commit comment required: false + enable-commit-status: + description: Enable GitHub commit status + required: false overwrites-pull-request-comment: description: Overwrites pull request comment required: false diff --git a/dist/index.js b/dist/index.js index 3f51fd87..639af410 100644 --- a/dist/index.js +++ b/dist/index.js @@ -186322,21 +186322,23 @@ function run(inputs) { // eslint-disable-next-line no-console console.error(err); } - try { - yield githubClient.repos.createCommitStatus({ - owner: github_1.context.repo.owner, - repo: github_1.context.repo.repo, - context: 'Netlify', - description: 'Netlify deployment', - state: 'success', - sha: github_1.context.sha, - // eslint-disable-next-line @typescript-eslint/camelcase - target_url: deployUrl - }); - } - catch (err) { - // eslint-disable-next-line no-console - console.error(err); + if (inputs.enableCommitStatus()) { + try { + yield githubClient.repos.createCommitStatus({ + owner: github_1.context.repo.owner, + repo: github_1.context.repo.repo, + context: 'Netlify', + description: 'Netlify deployment', + state: 'success', + sha: github_1.context.sha, + // eslint-disable-next-line @typescript-eslint/camelcase + target_url: deployUrl + }); + } + catch (err) { + // eslint-disable-next-line no-console + console.error(err); + } } } catch (error) { @@ -261628,6 +261630,10 @@ exports.defaultInputs = { // Default: true return (core.getInput('enable-commit-comment') || 'true') === 'true'; }, + enableCommitStatus() { + // Default: true + return (core.getInput('enable-commit-status') || 'true') === 'true'; + }, githubToken() { return core.getInput('github-token'); }, diff --git a/src/inputs.ts b/src/inputs.ts index db6f88bb..5237112d 100644 --- a/src/inputs.ts +++ b/src/inputs.ts @@ -9,6 +9,7 @@ export interface Inputs { productionDeploy(): boolean enablePullRequestComment(): boolean enableCommitComment(): boolean + enableCommitStatus(): boolean githubToken(): string overwritesPullRequestComment(): boolean netlifyConfigPath(): string | undefined @@ -41,6 +42,10 @@ export const defaultInputs: Inputs = { // Default: true return (core.getInput('enable-commit-comment') || 'true') === 'true' }, + enableCommitStatus() { + // Default: true + return (core.getInput('enable-commit-status') || 'true') === 'true' + }, githubToken() { return core.getInput('github-token') }, diff --git a/src/main.ts b/src/main.ts index 985fe11b..759060f5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -192,20 +192,22 @@ export async function run(inputs: Inputs): Promise { console.error(err) } - try { - await githubClient.repos.createCommitStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - context: 'Netlify', - description: 'Netlify deployment', - state: 'success', - sha: context.sha, - // eslint-disable-next-line @typescript-eslint/camelcase - target_url: deployUrl - }) - } catch (err) { - // eslint-disable-next-line no-console - console.error(err) + if (inputs.enableCommitStatus()) { + try { + await githubClient.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + context: 'Netlify', + description: 'Netlify deployment', + state: 'success', + sha: context.sha, + // eslint-disable-next-line @typescript-eslint/camelcase + target_url: deployUrl + }) + } catch (err) { + // eslint-disable-next-line no-console + console.error(err) + } } } catch (error) { core.setFailed(error.message) From e8da81360feb797ff804e34ef0b9c3e9c8929f4d Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Fri, 21 Aug 2020 22:14:44 +0900 Subject: [PATCH 2/2] bump: 1.1.9 --- CHANGELOG.md | 7 ++++++- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65619fa4..efeea236 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) ## [Unreleased] +## [1.1.9] - 2020-08-21 +### Added +* Add "enable-commit-status" input + ## [1.1.8] - 2020-08-20 ### Added * Add GitHub commit status @@ -134,7 +138,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.1.8...HEAD +[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.1.9...HEAD +[1.1.9]: https://github.com/nwtgck/actions-netlify/compare/v1.1.8...v1.1.9 [1.1.8]: https://github.com/nwtgck/actions-netlify/compare/v1.1.7...v1.1.8 [1.1.7]: https://github.com/nwtgck/actions-netlify/compare/v1.1.6...v1.1.7 [1.1.6]: https://github.com/nwtgck/actions-netlify/compare/v1.1.5...v1.1.6 diff --git a/package-lock.json b/package-lock.json index 7f8e2515..e7a36e80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "actions-netlify", - "version": "1.1.8", + "version": "1.1.9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c5d2ab67..127fd068 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "actions-netlify", - "version": "1.1.8", + "version": "1.1.9", "private": true, "description": "GitHub Actions for Netlify", "main": "lib/main.js",