UNPKG

@atomist/sdm

Version:

Atomist Software Delivery Machine SDK

43 lines 2.19 kB
"use strict"; /* * Copyright © 2020 Atomist, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.MaterialChangeToNodeRepo = void 0; const logger_1 = require("@atomist/automation-client/lib/util/logger"); const filesChangedSince_1 = require("../../../api-helper/misc/git/filesChangedSince"); const PushTest_1 = require("../../../api/mapping/PushTest"); const FilesWithExtensionToWatch = ["js", "ts", "json", "yml", "xml", "html", "graphql", "jsx", "tsx", "sh"]; const FilesToWatch = ["Dockerfile"]; /** * Veto if change to deployment unit doesn't seem important enough to * build and deploy */ exports.MaterialChangeToNodeRepo = PushTest_1.pushTest("Material change to Node repo", async (pci) => { const changedFiles = await filesChangedSince_1.filesChangedSince(pci.project, pci.push); if (!changedFiles) { logger_1.logger.info("Cannot determine if change is material on %j: can't enumerate changed files", pci.id); return true; } logger_1.logger.debug(`MaterialChangeToNodeRepo: Changed files are [${changedFiles.join(",")}]`); if (filesChangedSince_1.anyFileChangedWithExtension(changedFiles, FilesWithExtensionToWatch) || filesChangedSince_1.anyFileChangedSuchThat(changedFiles, path => FilesToWatch.some(f => path === f))) { logger_1.logger.debug("Change is material on %j: changed files=[%s]", pci.id, changedFiles.join(",")); return true; } logger_1.logger.debug("Change is immaterial on %j: changed files=[%s]", pci.id, changedFiles.join(",")); return false; }); //# sourceMappingURL=materialChangeToNodeRepo.js.map