|
| 1 | +"use strict"; |
| 2 | +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { |
| 3 | + if (k2 === undefined) k2 = k; |
| 4 | + var desc = Object.getOwnPropertyDescriptor(m, k); |
| 5 | + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { |
| 6 | + desc = { enumerable: true, get: function() { return m[k]; } }; |
| 7 | + } |
| 8 | + Object.defineProperty(o, k2, desc); |
| 9 | +}) : (function(o, m, k, k2) { |
| 10 | + if (k2 === undefined) k2 = k; |
| 11 | + o[k2] = m[k]; |
| 12 | +})); |
| 13 | +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { |
| 14 | + Object.defineProperty(o, "default", { enumerable: true, value: v }); |
| 15 | +}) : function(o, v) { |
| 16 | + o["default"] = v; |
| 17 | +}); |
| 18 | +var __importStar = (this && this.__importStar) || function (mod) { |
| 19 | + if (mod && mod.__esModule) return mod; |
| 20 | + var result = {}; |
| 21 | + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); |
| 22 | + __setModuleDefault(result, mod); |
| 23 | + return result; |
| 24 | +}; |
| 25 | +Object.defineProperty(exports, "__esModule", { value: true }); |
| 26 | +exports.DefaultExcludedFiles = exports.SupportedOperatingSystems = exports.OperatingSystems = exports.Status = exports.action = exports.TestFlag = void 0; |
| 27 | +const core_1 = require("@actions/core"); |
| 28 | +const github = __importStar(require("@actions/github")); |
| 29 | +const util_1 = require("./util"); |
| 30 | +const { pusher, repository } = github.context.payload; |
| 31 | +/* |
| 32 | + * Flags to signal different scenarios to test cases |
| 33 | + */ |
| 34 | +var TestFlag; |
| 35 | +(function (TestFlag) { |
| 36 | + TestFlag[TestFlag["NONE"] = 0] = "NONE"; |
| 37 | + TestFlag[TestFlag["HAS_CHANGED_FILES"] = 2] = "HAS_CHANGED_FILES"; |
| 38 | + TestFlag[TestFlag["HAS_REMOTE_BRANCH"] = 4] = "HAS_REMOTE_BRANCH"; |
| 39 | + TestFlag[TestFlag["UNABLE_TO_REMOVE_ORIGIN"] = 8] = "UNABLE_TO_REMOVE_ORIGIN"; |
| 40 | + TestFlag[TestFlag["UNABLE_TO_UNSET_GIT_CONFIG"] = 16] = "UNABLE_TO_UNSET_GIT_CONFIG"; |
| 41 | + TestFlag[TestFlag["HAS_REJECTED_COMMIT"] = 32] = "HAS_REJECTED_COMMIT"; // Assume commit rejection. |
| 42 | +})(TestFlag || (exports.TestFlag = TestFlag = {})); |
| 43 | +/* Required action data that gets initialized when running within the GitHub Actions environment. */ |
| 44 | +exports.action = { |
| 45 | + folder: (0, core_1.getInput)('folder'), |
| 46 | + branch: (0, core_1.getInput)('branch'), |
| 47 | + commitMessage: (0, core_1.getInput)('commit-message'), |
| 48 | + dryRun: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('dry-run')) |
| 49 | + ? (0, core_1.getInput)('dry-run').toLowerCase() === 'true' |
| 50 | + : false, |
| 51 | + force: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('force')) |
| 52 | + ? (0, core_1.getInput)('force').toLowerCase() === 'true' |
| 53 | + : true, |
| 54 | + clean: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('clean')) |
| 55 | + ? (0, core_1.getInput)('clean').toLowerCase() === 'true' |
| 56 | + : false, |
| 57 | + cleanExclude: ((0, core_1.getInput)('clean-exclude') || '') |
| 58 | + .split('\n') |
| 59 | + .filter(l => l !== ''), |
| 60 | + hostname: process.env.GITHUB_SERVER_URL |
| 61 | + ? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL) |
| 62 | + : 'github.com', |
| 63 | + isTest: TestFlag.NONE, |
| 64 | + email: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-email')) |
| 65 | + ? (0, core_1.getInput)('git-config-email') |
| 66 | + : pusher && pusher.email |
| 67 | + ? pusher.email |
| 68 | + : `${process.env.GITHUB_ACTOR || 'github-pages-deploy-action'}@users.noreply.${process.env.GITHUB_SERVER_URL |
| 69 | + ? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL) |
| 70 | + : 'github.com'}`, |
| 71 | + name: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-name')) |
| 72 | + ? (0, core_1.getInput)('git-config-name') |
| 73 | + : pusher && pusher.name |
| 74 | + ? pusher.name |
| 75 | + : process.env.GITHUB_ACTOR |
| 76 | + ? process.env.GITHUB_ACTOR |
| 77 | + : 'GitHub Pages Deploy Action', |
| 78 | + repositoryName: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('repository-name')) |
| 79 | + ? (0, core_1.getInput)('repository-name') |
| 80 | + : repository && repository.full_name |
| 81 | + ? repository.full_name |
| 82 | + : process.env.GITHUB_REPOSITORY, |
| 83 | + token: (0, core_1.getInput)('token'), |
| 84 | + singleCommit: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('single-commit')) |
| 85 | + ? (0, core_1.getInput)('single-commit').toLowerCase() === 'true' |
| 86 | + : false, |
| 87 | + silent: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('silent')) |
| 88 | + ? (0, core_1.getInput)('silent').toLowerCase() === 'true' |
| 89 | + : false, |
| 90 | + sshKey: (0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key')) |
| 91 | + ? false |
| 92 | + : !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key')) && |
| 93 | + (0, core_1.getInput)('ssh-key').toLowerCase() === 'true' |
| 94 | + ? true |
| 95 | + : (0, core_1.getInput)('ssh-key'), |
| 96 | + targetFolder: (0, core_1.getInput)('target-folder'), |
| 97 | + workspace: process.env.GITHUB_WORKSPACE || '', |
| 98 | + tag: (0, core_1.getInput)('tag') |
| 99 | +}; |
| 100 | +/** Status codes for the action. */ |
| 101 | +var Status; |
| 102 | +(function (Status) { |
| 103 | + Status["SUCCESS"] = "success"; |
| 104 | + Status["FAILED"] = "failed"; |
| 105 | + Status["SKIPPED"] = "skipped"; |
| 106 | + Status["RUNNING"] = "running"; |
| 107 | +})(Status || (exports.Status = Status = {})); |
| 108 | +/* Platform codes. */ |
| 109 | +var OperatingSystems; |
| 110 | +(function (OperatingSystems) { |
| 111 | + OperatingSystems["LINUX"] = "Linux"; |
| 112 | + OperatingSystems["WINDOWS"] = "Windows"; |
| 113 | + OperatingSystems["MACOS"] = "macOS"; |
| 114 | +})(OperatingSystems || (exports.OperatingSystems = OperatingSystems = {})); |
| 115 | +exports.SupportedOperatingSystems = [OperatingSystems.LINUX]; |
| 116 | +/* Excluded files. */ |
| 117 | +var DefaultExcludedFiles; |
| 118 | +(function (DefaultExcludedFiles) { |
| 119 | + DefaultExcludedFiles["CNAME"] = "CNAME"; |
| 120 | + DefaultExcludedFiles["NOJEKYLL"] = ".nojekyll"; |
| 121 | + DefaultExcludedFiles["SSH"] = ".ssh"; |
| 122 | + DefaultExcludedFiles["GIT"] = ".git"; |
| 123 | + DefaultExcludedFiles["GITHUB"] = ".github"; |
| 124 | +})(DefaultExcludedFiles || (exports.DefaultExcludedFiles = DefaultExcludedFiles = {})); |
0 commit comments