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 3.6.1 to 3.6.2

43

__tests__/git.test.ts

@@ -244,2 +244,22 @@ // Initial env variable setup for tests.

})
it('should stash changes if preserve is true', async () => {
Object.assign(action, {
silent: false,
repositoryPath: 'JamesIves/github-pages-deploy-action',
accessToken: '123',
branch: 'branch',
folder: '.',
preserve: true,
isTest: true,
pusher: {
name: 'asd',
email: 'as@cat'
}
})
await init(action)
expect(execute).toBeCalledTimes(7)
})
})

@@ -368,2 +388,25 @@

it('should execute stash apply commands if preserve is true', async () => {
Object.assign(action, {
silent: false,
folder: 'assets',
branch: 'branch',
gitHubToken: '123',
lfs: true,
preserve: true,
isTest: true,
pusher: {
name: 'asd',
email: 'as@cat'
}
})
const response = await deploy(action)
// Includes the call to generateBranch
expect(execute).toBeCalledTimes(14)
expect(rmRF).toBeCalledTimes(1)
expect(response).toBe(Status.SUCCESS)
})
it('should not ignore CNAME or nojekyll if they exist in the deployment folder', async () => {

@@ -370,0 +413,0 @@ Object.assign(action, {

2

lib/constants.d.ts

@@ -28,2 +28,4 @@ export interface ActionInterface {

name?: string;
/** Determines if the workspace should be stashed/restored prior to comitting. */
preserve?: boolean | null;
/** The repository path, for example JamesIves/github-pages-deploy-action. */

@@ -30,0 +32,0 @@ repositoryName?: string;

@@ -58,2 +58,5 @@ "use strict";

: 'GitHub Pages Deploy Action',
preserve: !util_1.isNullOrUndefined(core_1.getInput('PRESERVE'))
? core_1.getInput('PRESERVE').toLowerCase() === 'true'
: false,
repositoryName: !util_1.isNullOrUndefined(core_1.getInput('REPOSITORY_NAME'))

@@ -60,0 +63,0 @@ ? core_1.getInput('REPOSITORY_NAME')

@@ -32,4 +32,16 @@ "use strict";

yield execute_1.execute(`git config user.email "${action.email}"`, action.workspace, action.silent);
yield execute_1.execute(`git remote rm origin`, action.workspace, action.silent);
try {
yield execute_1.execute(`git remote rm origin`, action.workspace, action.silent);
if (action.isTest) {
throw new Error();
}
}
catch (_a) {
core_1.info('Attempted to remove origin but failed, continuing…');
}
yield execute_1.execute(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);
if (action.preserve) {
core_1.info(`Stashing workspace changes… ⬆️`);
yield execute_1.execute(`git stash`, action.workspace, action.silent);
}
yield execute_1.execute(`git fetch --no-recurse-submodules`, action.workspace, action.silent);

@@ -106,2 +118,14 @@ core_1.info('Git configured… 🔧');

}
if (action.preserve) {
core_1.info(`Applying stashed workspace changes… ⬆️`);
try {
yield execute_1.execute(`git stash apply`, action.workspace, action.silent);
if (action.isTest) {
throw new Error();
}
}
catch (_a) {
core_1.info('Unable to apply from stash, continuing…');
}
}
yield execute_1.execute(`git worktree add --checkout ${temporaryDeploymentDirectory} origin/${action.branch}`, action.workspace, action.silent);

@@ -119,3 +143,3 @@ // Ensures that items that need to be excluded from the clean job get parsed.

}
catch (_a) {
catch (_b) {
core_1.info('There was an error parsing your CLEAN_EXCLUDE items. Please refer to the README for more details. ❌');

@@ -122,0 +146,0 @@ }

14

package.json

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

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

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

"dependencies": {
"@actions/core": "1.2.5",
"@actions/core": "1.2.6",
"@actions/exec": "1.0.4",

@@ -44,11 +44,11 @@ "@actions/github": "4.0.0",

"devDependencies": {
"@types/jest": "26.0.13",
"@types/node": "14.10.1",
"eslint": "7.8.1",
"@types/jest": "26.0.14",
"@types/node": "14.11.2",
"eslint": "7.9.0",
"eslint-plugin-github": "3.4.1",
"eslint-plugin-jest": "24.0.0",
"eslint-plugin-jest": "24.0.2",
"eslint-plugin-prettier": "^3.1.2",
"jest": "25.5.4",
"jest-circus": "26.4.2",
"prettier": "2.1.1",
"prettier": "2.1.2",
"ts-jest": "25.5.1",

@@ -55,0 +55,0 @@ "typescript": "3.9.7"

@@ -154,4 +154,5 @@ <p align="center">

| `LFS` | If toggled all files will be migrated from [Git LFS](https://git-lfs.github.com/) so they can be comitted to the deployment branch. | `with` | **No** |
| `PRESERVE` | Preserves and restores the workspace prior to deployment. This option is useful if you're modifying files in the worktree that aren't comitted to Git. | `with` | **No** |
| `SILENT` | Silences the action output preventing it from displaying git messages. | `with` | **No** |
| `WORKSPACE` | This should point to where your project lives on the virtual machine. The GitHub Actions environment will set this for you. It is only neccersary to set this variable if you're using the node module. | `with` | **No** |
| `WORKSPACE` | This should point to where your project lives on the virtual machine. The GitHub Actions environment will set this for you. It is only necessary to set this variable if you're using the node module. | `with` | **No** |

@@ -158,0 +159,0 @@ With the action correctly configured you should see the workflow trigger the deployment under the configured conditions.

@@ -35,2 +35,4 @@ import {getInput} from '@actions/core'

name?: string
/** Determines if the workspace should be stashed/restored prior to comitting. */
preserve?: boolean | null
/** The repository path, for example JamesIves/github-pages-deploy-action. */

@@ -89,2 +91,5 @@ repositoryName?: string

: 'GitHub Pages Deploy Action',
preserve: !isNullOrUndefined(getInput('PRESERVE'))
? getInput('PRESERVE').toLowerCase() === 'true'
: false,
repositoryName: !isNullOrUndefined(getInput('REPOSITORY_NAME'))

@@ -91,0 +96,0 @@ ? getInput('REPOSITORY_NAME')

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

await execute(`git remote rm origin`, action.workspace, action.silent)
try {
await execute(`git remote rm origin`, action.workspace, action.silent)
if (action.isTest) {
throw new Error()
}
} catch {
info('Attempted to remove origin but failed, continuing…')
}
await execute(

@@ -39,2 +48,8 @@ `git remote add origin ${action.repositoryPath}`,

)
if (action.preserve) {
info(`Stashing workspace changes… ⬆️`)
await execute(`git stash`, action.workspace, action.silent)
}
await execute(

@@ -170,2 +185,16 @@ `git fetch --no-recurse-submodules`,

if (action.preserve) {
info(`Applying stashed workspace changes… ⬆️`)
try {
await execute(`git stash apply`, action.workspace, action.silent)
if (action.isTest) {
throw new Error()
}
} catch {
info('Unable to apply from stash, continuing…')
}
}
await execute(

@@ -172,0 +201,0 @@ `git worktree add --checkout ${temporaryDeploymentDirectory} origin/${action.branch}`,

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