Skip to content

Commit 800bbc8

Browse files
committed
Merge branch 'releases/v4' of https://github.com/JamesIves/github-pages-deploy-action into releases/v4
2 parents 5a66c61 + 30a0c82 commit 800bbc8

1,539 files changed

Lines changed: 152621 additions & 405523 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/constants.js

Lines changed: 44 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,101 @@
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 () {
19-
var ownKeys = function(o) {
20-
ownKeys = Object.getOwnPropertyNames || function (o) {
21-
var ar = [];
22-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23-
return ar;
24-
};
25-
return ownKeys(o);
26-
};
27-
return function (mod) {
28-
if (mod && mod.__esModule) return mod;
29-
var result = {};
30-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31-
__setModuleDefault(result, mod);
32-
return result;
33-
};
34-
})();
35-
Object.defineProperty(exports, "__esModule", { value: true });
36-
exports.DefaultExcludedFiles = exports.SupportedOperatingSystems = exports.OperatingSystems = exports.Status = exports.action = exports.TestFlag = void 0;
37-
const core_1 = require("@actions/core");
38-
const github = __importStar(require("@actions/github"));
39-
const util_1 = require("./util");
1+
import { getInput } from '@actions/core';
2+
import * as github from '@actions/github';
3+
import { isNullOrUndefined, stripProtocolFromUrl } from './util.js';
404
const { pusher, repository } = github.context.payload;
415
/*
426
* Flags to signal different scenarios to test cases
437
*/
44-
var TestFlag;
8+
export var TestFlag;
459
(function (TestFlag) {
4610
TestFlag[TestFlag["NONE"] = 0] = "NONE";
4711
TestFlag[TestFlag["HAS_CHANGED_FILES"] = 2] = "HAS_CHANGED_FILES";
4812
TestFlag[TestFlag["HAS_REMOTE_BRANCH"] = 4] = "HAS_REMOTE_BRANCH";
4913
TestFlag[TestFlag["UNABLE_TO_REMOVE_ORIGIN"] = 8] = "UNABLE_TO_REMOVE_ORIGIN";
5014
TestFlag[TestFlag["UNABLE_TO_UNSET_GIT_CONFIG"] = 16] = "UNABLE_TO_UNSET_GIT_CONFIG";
5115
TestFlag[TestFlag["HAS_REJECTED_COMMIT"] = 32] = "HAS_REJECTED_COMMIT"; // Assume commit rejection.
52-
})(TestFlag || (exports.TestFlag = TestFlag = {}));
16+
})(TestFlag || (TestFlag = {}));
5317
/* Required action data that gets initialized when running within the GitHub Actions environment. */
54-
exports.action = {
55-
folder: (0, core_1.getInput)('folder'),
56-
branch: (0, core_1.getInput)('branch'),
57-
commitMessage: (0, core_1.getInput)('commit-message'),
58-
dryRun: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('dry-run'))
59-
? (0, core_1.getInput)('dry-run').toLowerCase() === 'true'
18+
export const action = {
19+
folder: getInput('folder'),
20+
branch: getInput('branch'),
21+
commitMessage: getInput('commit-message'),
22+
dryRun: !isNullOrUndefined(getInput('dry-run'))
23+
? getInput('dry-run').toLowerCase() === 'true'
6024
: false,
61-
force: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('force'))
62-
? (0, core_1.getInput)('force').toLowerCase() === 'true'
25+
force: !isNullOrUndefined(getInput('force'))
26+
? getInput('force').toLowerCase() === 'true'
6327
: true,
64-
attemptLimit: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('attempt-limit'))
65-
? parseInt((0, core_1.getInput)('attempt-limit'), 10)
28+
attemptLimit: !isNullOrUndefined(getInput('attempt-limit'))
29+
? parseInt(getInput('attempt-limit'), 10)
6630
: 3,
67-
clean: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('clean'))
68-
? (0, core_1.getInput)('clean').toLowerCase() === 'true'
31+
clean: !isNullOrUndefined(getInput('clean'))
32+
? getInput('clean').toLowerCase() === 'true'
6933
: false,
70-
cleanExclude: ((0, core_1.getInput)('clean-exclude') || '')
34+
cleanExclude: (getInput('clean-exclude') || '')
7135
.split('\n')
7236
.filter(l => l !== ''),
7337
hostname: process.env.GITHUB_SERVER_URL
74-
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
38+
? stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
7539
: 'github.com',
7640
isTest: TestFlag.NONE,
77-
email: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-email'))
78-
? (0, core_1.getInput)('git-config-email')
41+
email: !isNullOrUndefined(getInput('git-config-email'))
42+
? getInput('git-config-email')
7943
: pusher && pusher.email
8044
? pusher.email
8145
: `${process.env.GITHUB_ACTOR || 'github-pages-deploy-action'}@users.noreply.${process.env.GITHUB_SERVER_URL
82-
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
46+
? stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
8347
: 'github.com'}`,
84-
name: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-name'))
85-
? (0, core_1.getInput)('git-config-name')
48+
name: !isNullOrUndefined(getInput('git-config-name'))
49+
? getInput('git-config-name')
8650
: pusher && pusher.name
8751
? pusher.name
8852
: process.env.GITHUB_ACTOR
8953
? process.env.GITHUB_ACTOR
9054
: 'GitHub Pages Deploy Action',
91-
repositoryName: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('repository-name'))
92-
? (0, core_1.getInput)('repository-name')
55+
repositoryName: !isNullOrUndefined(getInput('repository-name'))
56+
? getInput('repository-name')
9357
: repository && repository.full_name
9458
? repository.full_name
9559
: process.env.GITHUB_REPOSITORY,
96-
token: (0, core_1.getInput)('token'),
97-
singleCommit: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('single-commit'))
98-
? (0, core_1.getInput)('single-commit').toLowerCase() === 'true'
60+
token: getInput('token'),
61+
singleCommit: !isNullOrUndefined(getInput('single-commit'))
62+
? getInput('single-commit').toLowerCase() === 'true'
9963
: false,
100-
silent: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('silent'))
101-
? (0, core_1.getInput)('silent').toLowerCase() === 'true'
64+
silent: !isNullOrUndefined(getInput('silent'))
65+
? getInput('silent').toLowerCase() === 'true'
10266
: false,
103-
sshKey: (0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key'))
67+
sshKey: isNullOrUndefined(getInput('ssh-key'))
10468
? false
105-
: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key')) &&
106-
(0, core_1.getInput)('ssh-key').toLowerCase() === 'true'
69+
: !isNullOrUndefined(getInput('ssh-key')) &&
70+
getInput('ssh-key').toLowerCase() === 'true'
10771
? true
108-
: (0, core_1.getInput)('ssh-key'),
109-
targetFolder: (0, core_1.getInput)('target-folder'),
72+
: getInput('ssh-key'),
73+
targetFolder: getInput('target-folder'),
11074
workspace: process.env.GITHUB_WORKSPACE || '',
111-
tag: (0, core_1.getInput)('tag')
75+
tag: getInput('tag')
11276
};
11377
/** Status codes for the action. */
114-
var Status;
78+
export var Status;
11579
(function (Status) {
11680
Status["SUCCESS"] = "success";
11781
Status["FAILED"] = "failed";
11882
Status["SKIPPED"] = "skipped";
11983
Status["RUNNING"] = "running";
120-
})(Status || (exports.Status = Status = {}));
84+
})(Status || (Status = {}));
12185
/* Platform codes. */
122-
var OperatingSystems;
86+
export var OperatingSystems;
12387
(function (OperatingSystems) {
12488
OperatingSystems["LINUX"] = "Linux";
12589
OperatingSystems["WINDOWS"] = "Windows";
12690
OperatingSystems["MACOS"] = "macOS";
127-
})(OperatingSystems || (exports.OperatingSystems = OperatingSystems = {}));
128-
exports.SupportedOperatingSystems = [OperatingSystems.LINUX];
91+
})(OperatingSystems || (OperatingSystems = {}));
92+
export const SupportedOperatingSystems = [OperatingSystems.LINUX];
12993
/* Excluded files. */
130-
var DefaultExcludedFiles;
94+
export var DefaultExcludedFiles;
13195
(function (DefaultExcludedFiles) {
13296
DefaultExcludedFiles["CNAME"] = "CNAME";
13397
DefaultExcludedFiles["NOJEKYLL"] = ".nojekyll";
13498
DefaultExcludedFiles["SSH"] = ".ssh";
13599
DefaultExcludedFiles["GIT"] = ".git";
136100
DefaultExcludedFiles["GITHUB"] = ".github";
137-
})(DefaultExcludedFiles || (exports.DefaultExcludedFiles = DefaultExcludedFiles = {}));
101+
})(DefaultExcludedFiles || (DefaultExcludedFiles = {}));

lib/execute.js

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
1-
"use strict";
2-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4-
return new (P || (P = Promise))(function (resolve, reject) {
5-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8-
step((generator = generator.apply(thisArg, _arguments || [])).next());
9-
});
10-
};
11-
var __importDefault = (this && this.__importDefault) || function (mod) {
12-
return (mod && mod.__esModule) ? mod : { "default": mod };
13-
};
14-
Object.defineProperty(exports, "__esModule", { value: true });
15-
exports.execute = execute;
16-
exports.stdout = stdout;
17-
exports.stderr = stderr;
18-
const exec_1 = require("@actions/exec");
19-
const buffer_1 = __importDefault(require("buffer"));
1+
import { exec } from '@actions/exec';
2+
import buffer from 'buffer';
203
const output = { stdout: '', stderr: '' };
214
/** Wrapper around the GitHub toolkit exec command which returns the output.
225
* Also allows you to easily toggle the current working directory.
@@ -27,37 +10,35 @@ const output = { stdout: '', stderr: '' };
2710
* @param {boolean} ignoreReturnCode - Determines whether to throw an error
2811
* on a non-zero exit status or to leave implementation up to the caller.
2912
*/
30-
function execute(cmd_1, cwd_1, silent_1) {
31-
return __awaiter(this, arguments, void 0, function* (cmd, cwd, silent, ignoreReturnCode = false) {
32-
output.stdout = '';
33-
output.stderr = '';
34-
yield (0, exec_1.exec)(cmd, [], {
35-
// Silences the input unless the INPUT_DEBUG flag is set.
36-
silent,
37-
cwd,
38-
listeners: { stdout, stderr },
39-
ignoreReturnCode
40-
});
41-
return Promise.resolve(output);
13+
export async function execute(cmd, cwd, silent, ignoreReturnCode = false) {
14+
output.stdout = '';
15+
output.stderr = '';
16+
await exec(cmd, [], {
17+
// Silences the input unless the INPUT_DEBUG flag is set.
18+
silent,
19+
cwd,
20+
listeners: { stdout, stderr },
21+
ignoreReturnCode
4222
});
23+
return Promise.resolve(output);
4324
}
4425
/**
4526
* Writes the output of a command to the stdout buffer.
4627
*/
47-
function stdout(data) {
28+
export function stdout(data) {
4829
const dataString = data.toString().trim();
4930
if (output.stdout.length + dataString.length <
50-
buffer_1.default.constants.MAX_STRING_LENGTH) {
31+
buffer.constants.MAX_STRING_LENGTH) {
5132
output.stdout += dataString;
5233
}
5334
}
5435
/**
5536
* Writes the output of a command to the stderr buffer.
5637
*/
57-
function stderr(data) {
38+
export function stderr(data) {
5839
const dataString = data.toString().trim();
5940
if (output.stderr.length + dataString.length <
60-
buffer_1.default.constants.MAX_STRING_LENGTH) {
41+
buffer.constants.MAX_STRING_LENGTH) {
6142
output.stderr += dataString;
6243
}
6344
}

lib/git.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ActionInterface, Status } from './constants';
1+
import { ActionInterface, Status } from './constants.js';
22
/**
33
* Initializes git in the workspace.
44
*/

0 commit comments

Comments
 (0)