2019-11-19 23:06:27 +08:00
|
|
|
"use strict";
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
var result = {};
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
result["default"] = mod;
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2020-01-20 04:33:14 +08:00
|
|
|
const core_1 = require("@actions/core");
|
2019-11-19 23:06:27 +08:00
|
|
|
const github = __importStar(require("@actions/github"));
|
|
|
|
const { pusher, repository } = github.context.payload;
|
|
|
|
exports.workspace = process.env.GITHUB_WORKSPACE;
|
2020-01-20 04:33:14 +08:00
|
|
|
exports.folder = core_1.getInput("FOLDER", { required: true });
|
2020-01-20 02:15:19 +08:00
|
|
|
exports.root = ".";
|
2019-11-19 23:06:27 +08:00
|
|
|
// Required action data.
|
|
|
|
exports.action = {
|
2020-01-20 04:33:14 +08:00
|
|
|
accessToken: core_1.getInput("ACCESS_TOKEN"),
|
|
|
|
baseBranch: core_1.getInput("BASE_BRANCH"),
|
2019-11-19 23:06:27 +08:00
|
|
|
build: exports.folder,
|
2020-01-20 04:33:14 +08:00
|
|
|
branch: core_1.getInput("BRANCH"),
|
|
|
|
commitMessage: core_1.getInput("COMMIT_MESSAGE"),
|
|
|
|
clean: core_1.getInput("CLEAN"),
|
|
|
|
cleanExclude: core_1.getInput("CLEAN_EXCLUDE"),
|
2020-01-19 03:41:49 +08:00
|
|
|
defaultBranch: process.env.GITHUB_SHA ? process.env.GITHUB_SHA : "master",
|
2020-01-20 04:33:14 +08:00
|
|
|
isTest: process.env.UNIT_TEST,
|
|
|
|
ssh: core_1.getInput("SSH"),
|
2020-01-19 03:41:49 +08:00
|
|
|
email: pusher && pusher.email
|
|
|
|
? pusher.email
|
|
|
|
: `${process.env.GITHUB_ACTOR ||
|
|
|
|
"github-pages-deploy-action"}@users.noreply.github.com`,
|
2019-11-21 22:29:43 +08:00
|
|
|
gitHubRepository: repository && repository.full_name
|
|
|
|
? repository.full_name
|
|
|
|
: process.env.GITHUB_REPOSITORY,
|
2020-01-20 04:33:14 +08:00
|
|
|
gitHubToken: core_1.getInput("GITHUB_TOKEN"),
|
2019-11-22 23:01:06 +08:00
|
|
|
name: pusher && pusher.name
|
|
|
|
? pusher.name
|
|
|
|
: process.env.GITHUB_ACTOR
|
|
|
|
? process.env.GITHUB_ACTOR
|
|
|
|
: "GitHub Pages Deploy Action",
|
2020-01-20 04:33:14 +08:00
|
|
|
targetFolder: core_1.getInput("TARGET_FOLDER")
|
2019-11-19 23:06:27 +08:00
|
|
|
};
|
2020-01-20 02:15:19 +08:00
|
|
|
// Token Types
|
|
|
|
exports.tokenType = exports.action.ssh
|
|
|
|
? "SSH"
|
|
|
|
: exports.action.accessToken
|
|
|
|
? "Access Token"
|
|
|
|
: exports.action.gitHubToken
|
|
|
|
? "GitHub Token"
|
|
|
|
: "...";
|
2019-11-19 23:06:27 +08:00
|
|
|
// Repository path used for commits/pushes.
|
2020-01-20 02:15:19 +08:00
|
|
|
exports.repositoryPath = exports.action.ssh
|
|
|
|
? `git@github.com:${exports.action.gitHubRepository}`
|
|
|
|
: `https://${exports.action.accessToken ||
|
|
|
|
`x-access-token:${exports.action.gitHubToken}`}@github.com/${exports.action.gitHubRepository}.git`;
|