UNPKG

pivotal-flow

Version:

šŸ”€ A command-line tool that helps you manage & automate your workflow to use with PivotalTracker.

44 lines (38 loc) • 1.81 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const chalk_1 = __importDefault(require("chalk")); const common_1 = require("../../utils/pivotal/common"); const hooks_1 = require("../../utils/hooks"); const console_1 = require("../../utils/console"); const git_1 = require("../../utils/git"); function postCheckoutHook(prevHead, currentHead, checkoutType) { if (hooks_1.shouldSkipBranchCheck(prevHead, currentHead, checkoutType)) { console_1.debugLog('skipping branch check'); return; } const branch = git_1.getCurrentBranch(); const branchIsNew = git_1.isNewBranch(prevHead, currentHead, branch); const { found: hasStoryId } = common_1.getStoryId(branch); const showWarning = branchIsNew && !hasStoryId; console_1.debugLogObject('post-checkout flags', { branch, branchIsNew, hasStoryId, showWarning }); if (showWarning) { console_1.warning(` ${chalk_1.default.inverse('[WARNING]')} A Pivotal Story ID is missing from your branch name! šŸ¦„ Your branch: ${chalk_1.default.white.bold(branch)} --- If this is your first time contributing to this repository - welcome! Please refer to: ${chalk_1.default.underline('https://github.com/ClearTax/pivotal-flow#usage')} to get started. ${chalk_1.default.dim(` Without the Pivotal Story ID in your branch name you would lose out on automatic updates to Pivotal stories via SCM and the commandline; some GitHub status checks might fail. Valid sample branch names: ‣ 'feature/shiny-new-feature_12345678' ‣ 'chore/changelogUpdate_12345678' ‣ 'bugfix/fix-some-strange-bug_12345678' `)}`); } } exports.default = postCheckoutHook;