Socket
Socket
Sign inDemoInstall

@jamesives/github-pages-deploy-action

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jamesives/github-pages-deploy-action - npm Package Compare versions

Comparing version 4.1.5 to 4.1.6

24

__tests__/git.test.ts

@@ -83,3 +83,3 @@ // Initial env variable setup for tests.

} catch (error) {
expect(error.message).toBe(
expect(error instanceof Error && error.message).toBe(
'There was an error initializing the repository: Mocked throw ❌'

@@ -172,3 +172,3 @@ )

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(12)
expect(execute).toBeCalledTimes(13)
expect(rmRF).toBeCalledTimes(1)

@@ -196,3 +196,3 @@ expect(response).toBe(Status.SUCCESS)

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(11)
expect(execute).toBeCalledTimes(12)
expect(rmRF).toBeCalledTimes(1)

@@ -222,3 +222,3 @@ expect(response).toBe(Status.SUCCESS)

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(12)
expect(execute).toBeCalledTimes(13)
expect(rmRF).toBeCalledTimes(1)

@@ -247,3 +247,3 @@ })

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(11)
expect(execute).toBeCalledTimes(12)
expect(rmRF).toBeCalledTimes(1)

@@ -273,3 +273,3 @@ })

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(11)
expect(execute).toBeCalledTimes(12)
expect(rmRF).toBeCalledTimes(1)

@@ -305,3 +305,3 @@ })

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(12)
expect(execute).toBeCalledTimes(13)
expect(rmRF).toBeCalledTimes(1)

@@ -338,3 +338,3 @@ expect(fs.existsSync).toBeCalledTimes(2)

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(9)
expect(execute).toBeCalledTimes(10)
expect(rmRF).toBeCalledTimes(1)

@@ -364,3 +364,3 @@ })

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(9)
expect(execute).toBeCalledTimes(10)
expect(rmRF).toBeCalledTimes(1)

@@ -385,3 +385,3 @@ })

expect(execute).toBeCalledTimes(9)
expect(execute).toBeCalledTimes(10)
expect(rmRF).toBeCalledTimes(1)

@@ -406,3 +406,3 @@ expect(mkdirP).toBeCalledTimes(1)

const response = await deploy(action)
expect(execute).toBeCalledTimes(9)
expect(execute).toBeCalledTimes(10)
expect(rmRF).toBeCalledTimes(1)

@@ -433,3 +433,3 @@ expect(response).toBe(Status.SKIPPED)

} catch (error) {
expect(error.message).toBe(
expect(error instanceof Error && error.message).toBe(
'The deploy step encountered an error: Mocked throw ❌'

@@ -436,0 +436,0 @@ )

@@ -52,3 +52,3 @@ // Initial env variable setup for tests.

await run(action)
expect(execute).toBeCalledTimes(14)
expect(execute).toBeCalledTimes(15)
expect(rmRF).toBeCalledTimes(1)

@@ -73,3 +73,3 @@ expect(exportVariable).toBeCalledTimes(1)

await run(action)
expect(execute).toBeCalledTimes(17)
expect(execute).toBeCalledTimes(18)
expect(rmRF).toBeCalledTimes(1)

@@ -76,0 +76,0 @@ expect(exportVariable).toBeCalledTimes(1)

@@ -136,3 +136,3 @@ import {exportVariable} from '@actions/core'

} catch (error) {
expect(error.message).toBe(
expect(error instanceof Error && error.message).toBe(
'The ssh client configuration encountered an error: Mocked throw ❌'

@@ -139,0 +139,0 @@ )

@@ -9,3 +9,4 @@ import {ActionInterface, TestFlag} from '../src/constants'

checkParameters,
stripProtocolFromUrl
stripProtocolFromUrl,
extractErrorMessage
} from '../src/util'

@@ -34,2 +35,22 @@

})
it('should return true if the value is null (with allowEmptyString)', async () => {
const value = null
expect(isNullOrUndefined(value, true)).toBeTruthy()
})
it('should return true if the value is undefined (with allowEmptyString)', async () => {
const value = undefined
expect(isNullOrUndefined(value, true)).toBeTruthy()
})
it('should return false if the value is defined (with allowEmptyString)', async () => {
const value = 'montezuma'
expect(isNullOrUndefined(value, true)).toBeFalsy()
})
it('should return false if the value is empty string (with allowEmptyString)', async () => {
const value = ''
expect(isNullOrUndefined(value, true)).toBeFalsy()
})
})

@@ -227,3 +248,3 @@

} catch (e) {
expect(e.message).toMatch(
expect(e instanceof Error && e.message).toMatch(
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true.'

@@ -248,3 +269,3 @@ )

} catch (e) {
expect(e.message).toMatch(
expect(e instanceof Error && e.message).toMatch(
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true.'

@@ -269,3 +290,3 @@ )

} catch (e) {
expect(e.message).toMatch('Branch is required.')
expect(e instanceof Error && e.message).toMatch('Branch is required.')
}

@@ -288,3 +309,3 @@ })

} catch (e) {
expect(e.message).toMatch(
expect(e instanceof Error && e.message).toMatch(
'You must provide the action with a folder to deploy.'

@@ -310,3 +331,3 @@ )

} catch (e) {
expect(e.message).toMatch(
expect(e instanceof Error && e.message).toMatch(
`The directory you're trying to deploy named notARealFolder doesn't exist. Please double check the path and any prerequisite build scripts and try again. ❗`

@@ -337,2 +358,20 @@ )

})
describe('extractErrorMessage', () => {
it('gets the message of a Error', () => {
expect(extractErrorMessage(new Error('a error message'))).toBe(
'a error message'
)
})
it('gets the message of a string', () => {
expect(extractErrorMessage('a error message')).toBe('a error message')
})
it('gets the message of a object', () => {
expect(extractErrorMessage({special: 'a error message'})).toBe(
`{"special":"a error message"}`
)
})
})
})

@@ -31,3 +31,3 @@ import {TestFlag} from '../src/constants'

} catch (error) {
expect(error.message).toBe(
expect(error instanceof Error && error.message).toBe(
'There was an error creating the worktree: Mocked throw ❌'

@@ -34,0 +34,0 @@ )

@@ -38,27 +38,27 @@ "use strict";

exports.action = {
folder: core_1.getInput('folder'),
branch: core_1.getInput('branch'),
commitMessage: core_1.getInput('commit-message'),
dryRun: !util_1.isNullOrUndefined(core_1.getInput('dry-run'))
? core_1.getInput('dry-run').toLowerCase() === 'true'
folder: (0, core_1.getInput)('folder'),
branch: (0, core_1.getInput)('branch'),
commitMessage: (0, core_1.getInput)('commit-message'),
dryRun: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('dry-run'))
? (0, core_1.getInput)('dry-run').toLowerCase() === 'true'
: false,
clean: !util_1.isNullOrUndefined(core_1.getInput('clean'))
? core_1.getInput('clean').toLowerCase() === 'true'
clean: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('clean'))
? (0, core_1.getInput)('clean').toLowerCase() === 'true'
: false,
cleanExclude: (core_1.getInput('clean-exclude') || '')
cleanExclude: ((0, core_1.getInput)('clean-exclude') || '')
.split('\n')
.filter(l => l !== ''),
hostname: process.env.GITHUB_SERVER_URL
? util_1.stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
: 'github.com',
isTest: TestFlag.NONE,
email: !util_1.isNullOrUndefined(core_1.getInput('git-config-email'))
? core_1.getInput('git-config-email')
email: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-email'), true)
? (0, core_1.getInput)('git-config-email')
: pusher && pusher.email
? pusher.email
: `${process.env.GITHUB_ACTOR || 'github-pages-deploy-action'}@users.noreply.${process.env.GITHUB_SERVER_URL
? util_1.stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
: 'github.com'}`,
name: !util_1.isNullOrUndefined(core_1.getInput('git-config-name'))
? core_1.getInput('git-config-name')
name: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-name'))
? (0, core_1.getInput)('git-config-name')
: pusher && pusher.name

@@ -69,21 +69,21 @@ ? pusher.name

: 'GitHub Pages Deploy Action',
repositoryName: !util_1.isNullOrUndefined(core_1.getInput('repository-name'))
? core_1.getInput('repository-name')
repositoryName: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('repository-name'))
? (0, core_1.getInput)('repository-name')
: repository && repository.full_name
? repository.full_name
: process.env.GITHUB_REPOSITORY,
token: core_1.getInput('token'),
singleCommit: !util_1.isNullOrUndefined(core_1.getInput('single-commit'))
? core_1.getInput('single-commit').toLowerCase() === 'true'
token: (0, core_1.getInput)('token'),
singleCommit: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('single-commit'))
? (0, core_1.getInput)('single-commit').toLowerCase() === 'true'
: false,
silent: !util_1.isNullOrUndefined(core_1.getInput('silent'))
? core_1.getInput('silent').toLowerCase() === 'true'
silent: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('silent'))
? (0, core_1.getInput)('silent').toLowerCase() === 'true'
: false,
sshKey: util_1.isNullOrUndefined(core_1.getInput('ssh-key'))
sshKey: (0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key'))
? false
: !util_1.isNullOrUndefined(core_1.getInput('ssh-key')) &&
core_1.getInput('ssh-key').toLowerCase() === 'true'
: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key')) &&
(0, core_1.getInput)('ssh-key').toLowerCase() === 'true'
? true
: core_1.getInput('ssh-key'),
targetFolder: core_1.getInput('target-folder'),
: (0, core_1.getInput)('ssh-key'),
targetFolder: (0, core_1.getInput)('target-folder'),
workspace: process.env.GITHUB_WORKSPACE || ''

@@ -90,0 +90,0 @@ };

@@ -29,3 +29,3 @@ "use strict";

output = '';
yield exec_1.exec(cmd, [], {
yield (0, exec_1.exec)(cmd, [], {
// Silences the input unless the INPUT_DEBUG flag is set.

@@ -32,0 +32,0 @@ silent,

@@ -27,6 +27,6 @@ "use strict";

try {
core_1.info(`Deploying using ${action.tokenType}… 🔑`);
core_1.info('Configuring git…');
yield execute_1.execute(`git config user.name "${action.name}"`, action.workspace, action.silent);
yield execute_1.execute(`git config user.email "${action.email}"`, action.workspace, action.silent);
(0, core_1.info)(`Deploying using ${action.tokenType}… 🔑`);
(0, core_1.info)('Configuring git…');
yield (0, execute_1.execute)(`git config user.name "${action.name}"`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git config user.email "${action.email ? action.email : '<>'}"`, action.workspace, action.silent);
try {

@@ -37,3 +37,3 @@ if ((process.env.CI && !action.sshKey) || action.isTest) {

*/
yield execute_1.execute(`git config --local --unset-all http.https://${action.hostname}/.extraheader`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git config --local --unset-all http.https://${action.hostname}/.extraheader`, action.workspace, action.silent);
}

@@ -45,6 +45,6 @@ if (action.isTest === constants_1.TestFlag.UNABLE_TO_UNSET_GIT_CONFIG) {

catch (_a) {
core_1.info('Unable to unset previous git config authentication as it may not exist, continuing…');
(0, core_1.info)('Unable to unset previous git config authentication as it may not exist, continuing…');
}
try {
yield execute_1.execute(`git remote rm origin`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git remote rm origin`, action.workspace, action.silent);
if (action.isTest === constants_1.TestFlag.UNABLE_TO_REMOVE_ORIGIN) {

@@ -55,9 +55,9 @@ throw new Error();

catch (_b) {
core_1.info('Attempted to remove origin but failed, continuing…');
(0, core_1.info)('Attempted to remove origin but failed, continuing…');
}
yield execute_1.execute(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);
core_1.info('Git configured… 🔧');
yield (0, execute_1.execute)(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);
(0, core_1.info)('Git configured… 🔧');
}
catch (error) {
throw new Error(`There was an error initializing the repository: ${util_1.suppressSensitiveInformation(error.message, action)} ❌`);
throw new Error(`There was an error initializing the repository: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)} ❌`);
}

@@ -74,5 +74,5 @@ });

.substr(2, 9)}`;
core_1.info('Starting to commit changes…');
(0, core_1.info)('Starting to commit changes…');
try {
const commitMessage = !util_1.isNullOrUndefined(action.commitMessage)
const commitMessage = !(0, util_1.isNullOrUndefined)(action.commitMessage)
? action.commitMessage

@@ -84,4 +84,4 @@ : `Deploying to ${action.branch}${process.env.GITHUB_SHA

const branchExists = action.isTest & constants_1.TestFlag.HAS_REMOTE_BRANCH ||
(yield execute_1.execute(`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`, action.workspace, action.silent));
yield worktree_1.generateWorktree(action, temporaryDeploymentDirectory, branchExists);
(yield (0, execute_1.execute)(`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`, action.workspace, action.silent));
yield (0, worktree_1.generateWorktree)(action, temporaryDeploymentDirectory, branchExists);
// Ensures that items that need to be excluded from the clean job get parsed.

@@ -95,4 +95,4 @@ let excludes = '';

if (action.targetFolder) {
core_1.info(`Creating target folder if it doesn't already exist… 📌`);
yield io_1.mkdirP(`${temporaryDeploymentDirectory}/${action.targetFolder}`);
(0, core_1.info)(`Creating target folder if it doesn't already exist… 📌`);
yield (0, io_1.mkdirP)(`${temporaryDeploymentDirectory}/${action.targetFolder}`);
}

@@ -103,3 +103,3 @@ /*

rsync is used to prevent file duplication. */
yield execute_1.execute(`rsync -q -av --checksum --progress ${action.folderPath}/. ${action.targetFolder
yield (0, execute_1.execute)(`rsync -q -av --checksum --progress ${action.folderPath}/. ${action.targetFolder
? `${temporaryDeploymentDirectory}/${action.targetFolder}`

@@ -116,3 +116,3 @@ : temporaryDeploymentDirectory} ${action.clean

if (action.singleCommit) {
yield execute_1.execute(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
}

@@ -126,5 +126,5 @@ // Use git status to check if we have something to commit.

: `git status --porcelain`;
core_1.info(`Checking if there are files to commit…`);
(0, core_1.info)(`Checking if there are files to commit…`);
const hasFilesToCommit = action.isTest & constants_1.TestFlag.HAS_CHANGED_FILES ||
(yield execute_1.execute(checkGitStatus, `${action.workspace}/${temporaryDeploymentDirectory}`, true // This output is always silenced due to the large output it creates.
(yield (0, execute_1.execute)(checkGitStatus, `${action.workspace}/${temporaryDeploymentDirectory}`, true // This output is always silenced due to the large output it creates.
));

@@ -137,20 +137,21 @@ if ((!action.singleCommit && !hasFilesToCommit) ||

// Commits to GitHub.
yield execute_1.execute(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield execute_1.execute(`git checkout -b ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield execute_1.execute(`git commit -m "${commitMessage}" --quiet --no-verify`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git checkout -b ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git commit -m "${commitMessage}" --quiet --no-verify`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
if (!action.dryRun) {
yield execute_1.execute(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
}
core_1.info(`Changes committed to the ${action.branch} branch… 📦`);
(0, core_1.info)(`Changes committed to the ${action.branch} branch… 📦`);
return constants_1.Status.SUCCESS;
}
catch (error) {
throw new Error(`The deploy step encountered an error: ${util_1.suppressSensitiveInformation(error.message, action)} ❌`);
throw new Error(`The deploy step encountered an error: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)} ❌`);
}
finally {
// Cleans up temporary files/folders and restores the git state.
core_1.info('Running post deployment cleanup jobs… 🗑️');
yield execute_1.execute(`git checkout -B ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield execute_1.execute(`git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, action.silent);
yield io_1.rmRF(temporaryDeploymentDirectory);
(0, core_1.info)('Running post deployment cleanup jobs… 🗑️');
yield (0, execute_1.execute)(`git checkout -B ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`chmod -R 777 ${temporaryDeploymentDirectory}`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, action.silent);
yield (0, io_1.rmRF)(temporaryDeploymentDirectory);
}

@@ -157,0 +158,0 @@ });

@@ -25,3 +25,3 @@ "use strict";

try {
core_1.info(`
(0, core_1.info)(`
GitHub Pages Deploy Action 🚀

@@ -35,22 +35,22 @@

💖 Support: https://github.com/sponsors/JamesIves`);
core_1.info('Checking configuration and starting deployment… 🚦');
(0, core_1.info)('Checking configuration and starting deployment… 🚦');
const settings = Object.assign({}, configuration);
// Defines the repository/folder paths and token types.
// Also verifies that the action has all of the required parameters.
settings.folderPath = util_1.generateFolderPath(settings);
util_1.checkParameters(settings);
settings.repositoryPath = util_1.generateRepositoryPath(settings);
settings.tokenType = util_1.generateTokenType(settings);
settings.folderPath = (0, util_1.generateFolderPath)(settings);
(0, util_1.checkParameters)(settings);
settings.repositoryPath = (0, util_1.generateRepositoryPath)(settings);
settings.tokenType = (0, util_1.generateTokenType)(settings);
if (settings.sshKey) {
yield ssh_1.configureSSH(settings);
yield (0, ssh_1.configureSSH)(settings);
}
yield git_1.init(settings);
status = yield git_1.deploy(settings);
yield (0, git_1.init)(settings);
status = yield (0, git_1.deploy)(settings);
}
catch (error) {
status = constants_1.Status.FAILED;
core_1.setFailed(error.message);
(0, core_1.setFailed)((0, util_1.extractErrorMessage)(error));
}
finally {
core_1.info(`${status === constants_1.Status.FAILED
(0, core_1.info)(`${status === constants_1.Status.FAILED
? 'Deployment failed! ❌'

@@ -60,4 +60,4 @@ : status === constants_1.Status.SUCCESS

: 'There is nothing to commit. Exiting early… 📭'}`);
core_1.exportVariable('deployment_status', status);
core_1.setOutput('deployment-status', status);
(0, core_1.exportVariable)('deployment_status', status);
(0, core_1.setOutput)('deployment-status', status);
}

@@ -64,0 +64,0 @@ });

@@ -9,2 +9,2 @@ "use strict";

// Runs the action within the GitHub actions environment.
lib_1.default(constants_1.action);
(0, lib_1.default)(constants_1.action);

@@ -27,12 +27,12 @@ "use strict";

const sshGitHubKnownHostDss = `\n${action.hostname} ssh-dss AAAAB3NzaC1kc3MAAACBANGFW2P9xlGU3zWrymJgI/lKo//ZW2WfVtmbsUZJ5uyKArtlQOT2+WRhcg4979aFxgKdcsqAYW3/LS1T2km3jYW/vr4Uzn+dXWODVk5VlUiZ1HFOHf6s6ITcZvjvdbp6ZbpM+DuJT7Bw+h5Fx8Qt8I16oCZYmAPJRtu46o9C2zk1AAAAFQC4gdFGcSbp5Gr0Wd5Ay/jtcldMewAAAIATTgn4sY4Nem/FQE+XJlyUQptPWMem5fwOcWtSXiTKaaN0lkk2p2snz+EJvAGXGq9dTSWHyLJSM2W6ZdQDqWJ1k+cL8CARAqL+UMwF84CR0m3hj+wtVGD/J4G5kW2DBAf4/bqzP4469lT+dF2FRQ2L9JKXrCWcnhMtJUvua8dvnwAAAIB6C4nQfAA7x8oLta6tT+oCk2WQcydNsyugE8vLrHlogoWEicla6cWPk7oXSspbzUcfkjN3Qa6e74PhRkc7JdSdAlFzU3m7LMkXo1MHgkqNX8glxWNVqBSc0YRdbFdTkL0C6gtpklilhvuHQCdbgB3LBAikcRkDp+FCVkUgPC/7Rw==\n`;
core_1.info(`Configuring SSH client… 🔑`);
yield io_1.mkdirP(sshDirectory);
fs_1.appendFileSync(sshKnownHostsDirectory, sshGitHubKnownHostRsa);
fs_1.appendFileSync(sshKnownHostsDirectory, sshGitHubKnownHostDss);
(0, core_1.info)(`Configuring SSH client… 🔑`);
yield (0, io_1.mkdirP)(sshDirectory);
(0, fs_1.appendFileSync)(sshKnownHostsDirectory, sshGitHubKnownHostRsa);
(0, fs_1.appendFileSync)(sshKnownHostsDirectory, sshGitHubKnownHostDss);
// Initializes SSH agent.
const agentOutput = child_process_1.execFileSync('ssh-agent').toString().split('\n');
const agentOutput = (0, child_process_1.execFileSync)('ssh-agent').toString().split('\n');
agentOutput.map(line => {
const exportableVariables = /^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/.exec(line);
if (exportableVariables && exportableVariables.length) {
core_1.exportVariable(exportableVariables[1], exportableVariables[2]);
(0, core_1.exportVariable)(exportableVariables[1], exportableVariables[2]);
}

@@ -42,12 +42,12 @@ });

action.sshKey.split(/(?=-----BEGIN)/).map((line) => __awaiter(this, void 0, void 0, function* () {
child_process_1.execSync('ssh-add -', { input: `${line.trim()}\n` });
(0, child_process_1.execSync)('ssh-add -', { input: `${line.trim()}\n` });
}));
child_process_1.execSync('ssh-add -l');
(0, child_process_1.execSync)('ssh-add -l');
}
else {
core_1.info(`Skipping SSH client configuration… ⌚`);
(0, core_1.info)(`Skipping SSH client configuration… ⌚`);
}
}
catch (error) {
throw new Error(`The ssh client configuration encountered an error: ${util_1.suppressSensitiveInformation(error.message, action)} ❌`);
throw new Error(`The ssh client configuration encountered an error: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)} ❌`);
}

@@ -54,0 +54,0 @@ });

import { ActionInterface } from './constants';
export declare const isNullOrUndefined: (value: unknown) => boolean;
export declare const isNullOrUndefined: (value: unknown, allowEmptyString?: boolean) => boolean;
export declare const generateTokenType: (action: ActionInterface) => string;

@@ -8,3 +8,4 @@ export declare const generateRepositoryPath: (action: ActionInterface) => string;

export declare const suppressSensitiveInformation: (str: string, action: ActionInterface) => string;
export declare const extractErrorMessage: (error: unknown) => string;
/** Strips the protocol from a provided URL. */
export declare const stripProtocolFromUrl: (url: string) => string;

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.stripProtocolFromUrl = exports.suppressSensitiveInformation = exports.checkParameters = exports.generateFolderPath = exports.generateRepositoryPath = exports.generateTokenType = exports.isNullOrUndefined = void 0;
exports.stripProtocolFromUrl = exports.extractErrorMessage = exports.suppressSensitiveInformation = exports.checkParameters = exports.generateFolderPath = exports.generateRepositoryPath = exports.generateTokenType = exports.isNullOrUndefined = void 0;
const core_1 = require("@actions/core");

@@ -13,4 +13,7 @@ const fs_1 = require("fs");

const replaceAll = (input, find, replace) => input.split(find).join(replace);
/* Utility function that checks to see if a value is undefined or not. */
const isNullOrUndefined = (value) => typeof value === 'undefined' || value === null || value === '';
/* Utility function that checks to see if a value is undefined or not.
If allowEmptyString is passed the parameter is allowed to contain an empty string as a valid parameter. */
const isNullOrUndefined = (value, allowEmptyString = false) => allowEmptyString
? typeof value === 'undefined' || value === null
: typeof value === 'undefined' || value === null || value === '';
exports.isNullOrUndefined = isNullOrUndefined;

@@ -37,3 +40,3 @@ /* Generates a token type used for the action. */

const hasRequiredParameters = (action, params) => {
const nonNullParams = params.filter(param => !exports.isNullOrUndefined(action[param]));
const nonNullParams = params.filter(param => !(0, exports.isNullOrUndefined)(action[param]));
return Boolean(nonNullParams.length);

@@ -52,3 +55,3 @@ };

}
if (!fs_1.existsSync(action.folderPath)) {
if (!(0, fs_1.existsSync)(action.folderPath)) {
throw new Error(`The directory you're trying to deploy named ${action.folderPath} doesn't exist. Please double check the path and any prerequisite build scripts and try again. ❗`);

@@ -61,3 +64,3 @@ }

let value = str;
if (core_1.isDebug()) {
if ((0, core_1.isDebug)()) {
// Data is unmasked in debug mode.

@@ -73,4 +76,10 @@ return value;

exports.suppressSensitiveInformation = suppressSensitiveInformation;
const extractErrorMessage = (error) => error instanceof Error
? error.message
: typeof error == 'string'
? error
: JSON.stringify(error);
exports.extractErrorMessage = extractErrorMessage;
/** Strips the protocol from a provided URL. */
const stripProtocolFromUrl = (url) => url.replace(/^(?:https?:\/\/)?(?:www\.)?/i, '').split('/')[0];
exports.stripProtocolFromUrl = stripProtocolFromUrl;

@@ -37,7 +37,7 @@ "use strict";

try {
core_1.info('Creating worktree…');
(0, core_1.info)('Creating worktree…');
if (branchExists) {
yield execute_1.execute(`git fetch --no-recurse-submodules --depth=1 origin ${action.branch}`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git fetch --no-recurse-submodules --depth=1 origin ${action.branch}`, action.workspace, action.silent);
}
yield execute_1.execute(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
const checkout = new GitCheckout(action.branch);

@@ -52,10 +52,10 @@ if (branchExists) {

}
yield execute_1.execute(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
yield (0, execute_1.execute)(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
if (!branchExists) {
core_1.info(`Created the ${action.branch} branch… 🔧`);
(0, core_1.info)(`Created the ${action.branch} branch… 🔧`);
// Our index is in HEAD state, reset
yield execute_1.execute('git reset --hard', `${action.workspace}/${worktreedir}`, action.silent);
yield (0, execute_1.execute)('git reset --hard', `${action.workspace}/${worktreedir}`, action.silent);
if (!action.singleCommit) {
// New history isn't singleCommit, create empty initial commit
yield execute_1.execute(`git commit --no-verify --allow-empty -m "Initial ${action.branch} commit"`, `${action.workspace}/${worktreedir}`, action.silent);
yield (0, execute_1.execute)(`git commit --no-verify --allow-empty -m "Initial ${action.branch} commit"`, `${action.workspace}/${worktreedir}`, action.silent);
}

@@ -65,3 +65,3 @@ }

catch (error) {
throw new Error(`There was an error creating the worktree: ${util_1.suppressSensitiveInformation(error.message, action)} ❌`);
throw new Error(`There was an error creating the worktree: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)} ❌`);
}

@@ -68,0 +68,0 @@ });

@@ -5,3 +5,3 @@ {

"author": "James Ives <iam@jamesiv.es> (https://jamesiv.es)",
"version": "4.1.5",
"version": "4.1.6",
"license": "MIT",

@@ -37,3 +37,3 @@ "main": "lib/lib.js",

"dependencies": {
"@actions/core": "1.5.0",
"@actions/core": "1.6.0",
"@actions/exec": "1.1.0",

@@ -44,17 +44,17 @@ "@actions/github": "5.0.0",

"devDependencies": {
"@types/jest": "27.0.1",
"@types/node": "16.7.2",
"@typescript-eslint/eslint-plugin": "4.29.3",
"@typescript-eslint/parser": "4.29.3",
"@types/jest": "27.0.2",
"@types/node": "16.11.7",
"@typescript-eslint/eslint-plugin": "4.33.0",
"@typescript-eslint/parser": "4.33.0",
"eslint": "7.32.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-jest": "24.4.0",
"eslint-plugin-prettier": "3.4.1",
"eslint-plugin-jest": "25.2.4",
"eslint-plugin-prettier": "4.0.0",
"jest": "26.6.3",
"jest-circus": "27.0.6",
"prettier": "2.3.2",
"jest-circus": "27.3.1",
"prettier": "2.4.1",
"rimraf": "3.0.2",
"ts-jest": "26.5.6",
"typescript": "4.3.5"
"typescript": "4.5.2"
}
}

@@ -63,3 +63,3 @@ <p align="center">

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.6
with:

@@ -79,3 +79,3 @@ branch: gh-pages # The branch the action should deploy to.

It's recommended that you use [Dependabot](https://dependabot.com/github-actions/) to keep your workflow up-to-date. You can find the latest tagged version on the [GitHub Marketplace](https://github.com/marketplace/actions/deploy-to-github-pages) or on the [releases page](https://github.com/JamesIves/github-pages-deploy-action/releases).
It's recommended that you use [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/configuring-dependabot-security-updates) to keep your workflow up-to-date and [secure](https://github.com/features/security). You can find the latest tagged version on the [GitHub Marketplace](https://github.com/marketplace/actions/deploy-to-github-pages) or on the [releases page](https://github.com/JamesIves/github-pages-deploy-action/releases).

@@ -142,3 +142,3 @@ #### Install as a Node Module 📦

| `git-config-name` | Allows you to customize the name that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the name in the GitHub context, followed by the name of the action. | `with` | **No** |
| `git-config-email` | Allows you to customize the email that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the email in the GitHub context, followed by a generic noreply GitHub email. | `with` | **No** |
| `git-config-email` | Allows you to customize the email that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the email in the GitHub context, followed by a generic noreply GitHub email. You can include an empty string value if you wish to omit this field altogether. | `with` | **No** |
| `repository-name` | Allows you to specify a different repository path so long as you have permissions to push to it. This should be formatted like so: `JamesIves/github-pages-deploy-action`. You'll need to use a PAT in the `token` input for this configuration option to work properly. | `with` | **No** |

@@ -184,3 +184,3 @@ | `target-folder` | If you'd like to push the contents of the deployment folder into a specific directory on the deployment branch you can specify it here. | `with` | **No** |

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.6
with:

@@ -214,3 +214,3 @@ branch: gh-pages

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.6
with:

@@ -282,3 +282,3 @@ branch: gh-pages

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.6
with:

@@ -304,3 +304,3 @@ branch: gh-pages

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.6
```

@@ -336,3 +336,3 @@

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.6
with:

@@ -339,0 +339,0 @@ branch: gh-pages

@@ -98,3 +98,3 @@ import {getInput} from '@actions/core'

isTest: TestFlag.NONE,
email: !isNullOrUndefined(getInput('git-config-email'))
email: !isNullOrUndefined(getInput('git-config-email'), true)
? getInput('git-config-email')

@@ -101,0 +101,0 @@ : pusher && pusher.email

@@ -7,3 +7,7 @@ import {info} from '@actions/core'

import {generateWorktree} from './worktree'
import {isNullOrUndefined, suppressSensitiveInformation} from './util'
import {
extractErrorMessage,
isNullOrUndefined,
suppressSensitiveInformation
} from './util'

@@ -22,3 +26,3 @@ /* Initializes git in the workspace. */

await execute(
`git config user.email "${action.email}"`,
`git config user.email "${action.email ? action.email : '<>'}"`,
action.workspace,

@@ -68,3 +72,3 @@ action.silent

`There was an error initializing the repository: ${suppressSensitiveInformation(
error.message,
extractErrorMessage(error),
action

@@ -214,3 +218,3 @@ )} ❌`

`The deploy step encountered an error: ${suppressSensitiveInformation(
error.message,
extractErrorMessage(error),
action

@@ -230,2 +234,8 @@ )} ❌`

await execute(
`chmod -R 777 ${temporaryDeploymentDirectory}`,
action.workspace,
action.silent
)
await execute(
`git worktree remove ${temporaryDeploymentDirectory} --force`,

@@ -232,0 +242,0 @@ action.workspace,

@@ -7,2 +7,3 @@ import {exportVariable, info, setFailed, setOutput} from '@actions/core'

checkParameters,
extractErrorMessage,
generateFolderPath,

@@ -56,3 +57,3 @@ generateRepositoryPath,

status = Status.FAILED
setFailed(error.message)
setFailed(extractErrorMessage(error))
} finally {

@@ -59,0 +60,0 @@ info(

@@ -6,3 +6,3 @@ import {exportVariable, info} from '@actions/core'

import {ActionInterface} from './constants'
import {suppressSensitiveInformation} from './util'
import {extractErrorMessage, suppressSensitiveInformation} from './util'

@@ -50,3 +50,3 @@ export async function configureSSH(action: ActionInterface): Promise<void> {

`The ssh client configuration encountered an error: ${suppressSensitiveInformation(
error.message,
extractErrorMessage(error),
action

@@ -53,0 +53,0 @@ )} ❌`

@@ -10,5 +10,11 @@ import {isDebug} from '@actions/core'

/* Utility function that checks to see if a value is undefined or not. */
export const isNullOrUndefined = (value: unknown): boolean =>
typeof value === 'undefined' || value === null || value === ''
/* Utility function that checks to see if a value is undefined or not.
If allowEmptyString is passed the parameter is allowed to contain an empty string as a valid parameter. */
export const isNullOrUndefined = (
value: unknown,
allowEmptyString = false
): boolean =>
allowEmptyString
? typeof value === 'undefined' || value === null
: typeof value === 'undefined' || value === null || value === ''

@@ -94,4 +100,11 @@ /* Generates a token type used for the action. */

export const extractErrorMessage = (error: unknown): string =>
error instanceof Error
? error.message
: typeof error == 'string'
? error
: JSON.stringify(error)
/** Strips the protocol from a provided URL. */
export const stripProtocolFromUrl = (url: string): string =>
url.replace(/^(?:https?:\/\/)?(?:www\.)?/i, '').split('/')[0]
import {info} from '@actions/core'
import {ActionInterface} from './constants'
import {execute} from './execute'
import {suppressSensitiveInformation} from './util'
import {extractErrorMessage, suppressSensitiveInformation} from './util'

@@ -80,3 +80,3 @@ export class GitCheckout {

`There was an error creating the worktree: ${suppressSensitiveInformation(
error.message,
extractErrorMessage(error),
action

@@ -83,0 +83,0 @@ )} ❌`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc