From f6b43a668c2a4743ab96d1f7da91b30b0240de14 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sat, 29 Aug 2020 14:10:50 +0200 Subject: [PATCH] Fix pre commit failing on modified ts code (#4) * The npm release step will not add generated files automaticaly Previously the release step was adding the generated dist files to git automatically, which was not a good idea because pre-commit did not fail in case someone modified the .ts file Now the pre-commit check for npm will behave like all other pre-commit checks - if a file will be modified by the check, the file will not be added and pre-commit check will fail allowing the author to add the file manually. --- dist/index.js | 8 +++++++- package.json | 2 +- src/main.ts | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2da1e6e..3c03be4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1466,7 +1466,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); const github = __importStar(__webpack_require__(469)); const core = __importStar(__webpack_require__(393)); const treemap = __importStar(__webpack_require__(706)); -const CANCELLABLE_RUNS = ['push', 'pull_request', 'workflow_run', 'schedule', 'workflow_dispatch']; +const CANCELLABLE_RUNS = [ + 'push', + 'pull_request', + 'workflow_run', + 'schedule', + 'workflow_dispatch' +]; var CancelMode; (function (CancelMode) { CancelMode["DUPLICATES"] = "duplicates"; diff --git a/package.json b/package.json index e739d21..17a13dc 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "pack": "ncc build", "test": "jest", "all": "npm run build && npm run format && npm run lint && npm run pack && npm test", - "release": "ncc build -o dist src/main.ts && git add -f dist/" + "release": "ncc build -o dist src/main.ts" }, "repository": { "type": "git", diff --git a/src/main.ts b/src/main.ts index c4ee4da..01a8a9d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,13 @@ import * as core from '@actions/core' import * as rest from '@octokit/rest' import * as treemap from 'jstreemap' -const CANCELLABLE_RUNS = ['push', 'pull_request', 'workflow_run', 'schedule', 'workflow_dispatch'] +const CANCELLABLE_RUNS = [ + 'push', + 'pull_request', + 'workflow_run', + 'schedule', + 'workflow_dispatch' +] enum CancelMode { DUPLICATES = 'duplicates',