Socket
Socket
Sign inDemoInstall

github-pages-deploy-action

Package Overview
Dependencies
59
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.4.2 to 3.4.3

6

__tests__/execute.test.ts

@@ -10,3 +10,3 @@ import {execute, stdout} from '../src/execute'

it('should be called with the correct arguments', async () => {
await stdout('hello')
stdout('hello')
await execute('echo Montezuma', './')

@@ -24,5 +24,5 @@

it('should not silence the input when INPUT_DEBUG is defined', async () => {
process.env['DEBUG_DEPLOY_ACTION'] = 'yes'
process.env['RUNNER_DEBUG'] = '1'
await stdout('hello')
stdout('hello')
await execute('echo Montezuma', './')

@@ -29,0 +29,0 @@

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

import {execute} from '../src/execute'
import {setFailed} from '@actions/core'

@@ -15,3 +14,5 @@ const originalAction = JSON.stringify(action)

setFailed: jest.fn(),
getInput: jest.fn()
getInput: jest.fn(),
isDebug: jest.fn(),
info: jest.fn()
}))

@@ -323,2 +324,20 @@

it('should execute commands with single commit toggled', async () => {
Object.assign(action, {
folder: 'build',
branch: 'branch',
gitHubToken: '123',
singleCommit: true,
pusher: {
name: 'asd',
email: 'as@cat'
}
})
await deploy(action)
// Includes the call to generateBranch
expect(execute).toBeCalledTimes(18)
})
it('should execute commands with clean options, ommits sha commit message', async () => {

@@ -325,0 +344,0 @@ process.env.GITHUB_SHA = ''

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

getInput: jest.fn(),
exportVariable: jest.fn()
exportVariable: jest.fn(),
isDebug: jest.fn(),
info: jest.fn()
}))

@@ -24,0 +26,0 @@

@@ -162,3 +162,3 @@ import {

process.env['INPUT_DEBUG'] = 'true'
process.env['RUNNER_DEBUG'] = '1'

@@ -165,0 +165,0 @@ const string = `This is an error message! It contains ${action.accessToken} and ${action.gitHubToken} and ${action.repositoryPath}`

@@ -14,12 +14,27 @@ # Contributing

In order to deploy and test your own fork of this action, you must commit the required `node_modules` dependencies.
In order to deploy and test your own fork of this action, you must commit the required `node_modules` dependencies. Be sure to run `nvm use` before installing any dependencies. You can learn more about nvm [here](https://github.com/nvm-sh/nvm/blob/master/README.md).
To do this you can follow the instructions below:
Install the project:
```
# comment out in distribution branches
yarn install
```
Comment out the following in distribution branches:
```
# node_modules/
```
Build the project:
```
yarn build
```
Commit:
```
$ git checkout -b branchnamehere

@@ -29,2 +44,2 @@ $ git commit -a -m "prod dependencies"

The `node_modules` folder should _not_ be included when making a pull request.
The `node_modules` folder should _not_ be included when making a pull request. These are only required for GitHub Actions when it consumes the distribution branch branch, the `dev` branch of the project should be free from any dependencies or lib files.

@@ -9,3 +9,3 @@ export interface ActionInterface {

/** If your project generates hashed files on build you can use this option to automatically delete them from the deployment branch with each deploy. This option can be toggled on by setting it to true. */
clean?: string | boolean;
clean?: boolean | null;
/** If you need to use CLEAN but you'd like to preserve certain files or folders you can use this option. */

@@ -15,4 +15,2 @@ cleanExclude?: string | string[];

commitMessage?: string;
/** Unhides the Git commands from the function terminal. */
debug?: boolean | string;
/** The default branch of the deployment. Similar to baseBranch if you're using this action as a module. */

@@ -27,3 +25,3 @@ defaultBranch?: string;

/** Determines if the action is running in test mode or not. */
isTest?: string | undefined | null;
isTest?: boolean | null;
/** The git config name. */

@@ -37,4 +35,6 @@ name?: string;

root?: string;
/** Wipes the commit history from the deployment branch in favor of a single commit. */
singleCommit?: boolean | null;
/** Set to true if you're using an ssh client in your build step. */
ssh?: string | boolean | null;
ssh?: boolean | null;
/** 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. */

@@ -41,0 +41,0 @@ targetFolder?: string;

@@ -21,8 +21,10 @@ "use strict";

commitMessage: core_1.getInput('COMMIT_MESSAGE'),
clean: core_1.getInput('CLEAN'),
clean: !util_1.isNullOrUndefined(core_1.getInput('CLEAN'))
? core_1.getInput('CLEAN').toLowerCase() === 'true'
: false,
cleanExclude: core_1.getInput('CLEAN_EXCLUDE'),
debug: core_1.getInput('DEBUG'),
defaultBranch: process.env.GITHUB_SHA ? process.env.GITHUB_SHA : 'master',
isTest: process.env.UNIT_TEST,
ssh: core_1.getInput('SSH'),
isTest: process.env.UNIT_TEST
? process.env.UNIT_TEST.toLowerCase() === 'true'
: false,
email: !util_1.isNullOrUndefined(core_1.getInput('GIT_CONFIG_EMAIL'))

@@ -32,4 +34,3 @@ ? core_1.getInput('GIT_CONFIG_EMAIL')

? pusher.email
: `${process.env.GITHUB_ACTOR ||
'github-pages-deploy-action'}@users.noreply.github.com`,
: `${process.env.GITHUB_ACTOR || 'github-pages-deploy-action'}@users.noreply.github.com`,
gitHubToken: core_1.getInput('GITHUB_TOKEN'),

@@ -49,4 +50,10 @@ name: !util_1.isNullOrUndefined(core_1.getInput('GIT_CONFIG_NAME'))

root: '.',
singleCommit: !util_1.isNullOrUndefined(core_1.getInput('SINGLE_COMMIT'))
? core_1.getInput('SINGLE_COMMIT').toLowerCase() === 'true'
: false,
ssh: !util_1.isNullOrUndefined(core_1.getInput('SSH'))
? core_1.getInput('SSH').toLowerCase() === 'true'
: false,
targetFolder: core_1.getInput('TARGET_FOLDER'),
workspace: process.env.GITHUB_WORKSPACE || ''
};

@@ -12,2 +12,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@actions/core");
const exec_1 = require("@actions/exec");

@@ -26,3 +27,3 @@ let output;

// Silences the input unless the INPUT_DEBUG flag is set.
silent: process.env.DEBUG_DEPLOY_ACTION ? false : true,
silent: core_1.isDebug() ? false : true,
cwd,

@@ -29,0 +30,0 @@ listeners: {

@@ -12,2 +12,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@actions/core");
const execute_1 = require("./execute");

@@ -20,4 +21,4 @@ const util_1 = require("./util");

util_1.hasRequiredParameters(action);
console.log(`Deploying using ${action.tokenType}… 🔑`);
console.log('Configuring Git…');
core_1.info(`Deploying using ${action.tokenType}… 🔑`);
core_1.info('Configuring git…');
yield execute_1.execute(`git init`, action.workspace);

@@ -29,3 +30,3 @@ yield execute_1.execute(`git config user.name "${action.name}"`, action.workspace);

yield execute_1.execute(`git fetch`, action.workspace);
console.log('Git configured… 🔧');
core_1.info('Git configured… 🔧');
}

@@ -56,3 +57,3 @@ catch (error) {

util_1.hasRequiredParameters(action);
console.log(`Creating the ${action.branch} branch…`);
core_1.info(`Creating the ${action.branch} branch…`);
yield switchToBaseBranch(action);

@@ -62,5 +63,5 @@ yield execute_1.execute(`git checkout --orphan ${action.branch}`, action.workspace);

yield execute_1.execute(`git commit --allow-empty -m "Initial ${action.branch} commit"`, action.workspace);
yield execute_1.execute(`git push ${action.repositoryPath} ${action.branch}`, action.workspace);
yield execute_1.execute(`git push --force ${action.repositoryPath} ${action.branch}`, action.workspace);
yield execute_1.execute(`git fetch`, action.workspace);
console.log(`Created the ${action.branch} branch… 🔧`);
core_1.info(`Created the ${action.branch} branch… 🔧`);
}

@@ -78,5 +79,8 @@ catch (error) {

const temporaryDeploymentBranch = 'gh-action-temp-deployment-branch';
console.log('Starting to commit changes…');
core_1.info('Starting to commit changes…');
try {
util_1.hasRequiredParameters(action);
const commitMessage = `${!util_1.isNullOrUndefined(action.commitMessage)
? action.commitMessage
: `Deploying to ${action.branch} from ${action.baseBranch}`} ${process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''} 🚀`;
/*

@@ -106,3 +110,3 @@ Checks to see if the remote exists prior to deploying.

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

@@ -123,3 +127,3 @@ }

if (!hasFilesToCommit && !action.isTest) {
console.log('There is nothing to commit. Exiting early… 📭');
core_1.info('There is nothing to commit. Exiting early… 📭');
return;

@@ -130,9 +134,16 @@ }

yield execute_1.execute(`git checkout -b ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`);
yield execute_1.execute(`git commit -m "${!util_1.isNullOrUndefined(action.commitMessage)
? action.commitMessage
: `Deploying to ${action.branch} from ${action.baseBranch}`} ${process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''} 🚀" --quiet`, `${action.workspace}/${temporaryDeploymentDirectory}`);
yield execute_1.execute(`git commit -m "${commitMessage}" --quiet`, `${action.workspace}/${temporaryDeploymentDirectory}`);
yield execute_1.execute(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`);
console.log(`Changes committed to the ${action.branch} branch… 📦`);
core_1.info(`Changes committed to the ${action.branch} branch… 📦`);
// Cleans up temporary files/folders and restores the git state.
console.log('Running post deployment cleanup jobs…');
core_1.info('Running post deployment cleanup jobs…');
if (action.singleCommit) {
yield execute_1.execute(`git fetch ${action.repositoryPath}`, action.workspace);
yield execute_1.execute(`git checkout --orphan ${action.branch}-temp`, `${action.workspace}/${temporaryDeploymentDirectory}`);
yield execute_1.execute(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`);
yield execute_1.execute(`git commit -m "${commitMessage}" --quiet`, `${action.workspace}/${temporaryDeploymentDirectory}`);
yield execute_1.execute(`git branch -M ${action.branch}-temp ${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`);
yield execute_1.execute(`git push origin ${action.branch} --force`, `${action.workspace}/${temporaryDeploymentDirectory}`);
core_1.info('Cleared git history… 🚿');
}
yield execute_1.execute(`git checkout --progress --force ${action.defaultBranch}`, action.workspace);

@@ -139,0 +150,0 @@ }

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

try {
console.log('Checking configuration and starting deployment… 🚦');
core_1.info('Checking configuration and starting deployment… 🚦');
const settings = Object.assign(Object.assign({}, constants_1.action), configuration);

@@ -33,6 +33,2 @@ // Defines the repository paths and token types.

settings.tokenType = util_1.generateTokenType(settings);
if (settings.debug) {
// Sets the debug flag if passed as an arguement.
core_1.exportVariable('DEBUG_DEPLOY_ACTION', 'debug');
}
yield git_1.init(settings);

@@ -46,3 +42,3 @@ yield git_1.deploy(settings);

finally {
console.log(`${errorState
core_1.info(`${errorState
? 'Deployment Failed ❌'

@@ -49,0 +45,0 @@ : 'Completed Deployment Successfully! ✅'}`);

@@ -17,4 +17,3 @@ "use strict";

? `git@github.com:${action.repositoryName}`
: `https://${action.accessToken ||
`x-access-token:${action.gitHubToken}`}@github.com/${action.repositoryName}.git`;
: `https://${action.accessToken || `x-access-token:${action.gitHubToken}`}@github.com/${action.repositoryName}.git`;
/* Checks for the required tokens and formatting. Throws an error if any case is matched. */

@@ -41,3 +40,3 @@ exports.hasRequiredParameters = (action) => {

let value = str;
if (core_1.getInput('DEBUG')) {
if (core_1.isDebug()) {
// Data is unmasked in debug mode.

@@ -44,0 +43,0 @@ return value;

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

"author": "James Ives <iam@jamesiv.es>",
"version": "3.4.2",
"version": "3.4.3",
"license": "MIT",

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

"dependencies": {
"@actions/core": "^1.2.0",
"@actions/exec": "^1.0.2",
"@actions/github": "^2.0.0"
"@actions/core": "1.2.3",
"@actions/exec": "1.0.3",
"@actions/github": "2.1.1"
},
"devDependencies": {
"@types/jest": "^25.1.0",
"@types/node": "^13.1.2",
"jest": "^25.1.0",
"jest-circus": "^25.1.0",
"prettier": "^1.19.1",
"ts-jest": "^25.0.0",
"eslint": "^6.8.0",
"eslint-plugin-github": "^3.4.1",
"eslint-plugin-jest": "^23.8.2",
"typescript": "^3.7.4"
"@types/jest": "25.1.4",
"@types/node": "13.9.8",
"jest": "25.2.4",
"jest-circus": "25.2.4",
"prettier": "2.0.2",
"ts-jest": "25.3.0",
"eslint": "6.8.0",
"eslint-plugin-github": "3.4.1",
"eslint-plugin-jest": "23.8.2",
"typescript": "3.8.3"
}
}

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

The `with` portion of the workflow **must** be configured before the action will work. You can add these in the `with` section found in the examples above. Any `secrets` must be referenced using the bracket syntax and stored in the GitHub repositories `Settings/Secrets` menu. You can learn more about setting environment variables with GitHub actions [here](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepsenv).
The `with` portion of the workflow **must** be configured before the action will work. You can add these in the `with` section found in the examples above. Any `secrets` must be referenced using the bracket syntax and stored in the GitHub repositories `Settings/Secrets` menu. You can learn more about setting environment variables with GitHub actions [here](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets).

@@ -142,4 +142,4 @@ #### Required Setup

| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `GIT_CONFIG_NAME` | Allows you to customize the name that is attached to the GitHub 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 GitHub 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_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** |
| `REPOSITORY_NAME` | Allows you to speicfy 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`. | `with` | **No** |

@@ -151,4 +151,4 @@ | `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** |

| `CLEAN_EXCLUDE` | If you need to use `CLEAN` but you'd like to preserve certain files or folders you can use this option. This should be formatted as an array but stored as a string. For example: `'["filename.js", "folder"]'` | `with` | **No** |
| `SINGLE_COMMIT` | This option can be toggled to `true` if you'd prefer to have a single commit on the deployment branch instead of maintaining the full history. **Using this option will also cause any existing history to be wiped from the deployment branch**. | `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** |
| `DEBUG` | By default the git commands are hidden from the log. If you'd like to turn them on you can toggle this to `true`. **If you're using this action in your own project as a node module via yarn or npm you may expose your secrets if you toggle this on in a production environment**. | `with` | **No** |

@@ -169,3 +169,3 @@ With the action correctly configured you should see the workflow trigger the deployment under the configured conditions.

With this configured you must add the `ssh-agent` step to your workflow and set `SSH` to `true` within the deploy action.
With this configured you must add the `ssh-agent` step to your workflow and set `SSH` to `true` within the deploy action. There are several SSH actions available on the [GitHub marketplace](https://github.com/marketplace?type=actions) for you to choose from.

@@ -311,2 +311,8 @@ ```yml

This action maintains the full Git history of the deployment branch. Therefore if you're using a custom domain and require a `CNAME` file, or if you require the use of a `.nojekyll` file, you can safely commit these files directly into deployment branch without them being overridden after each deployment.
If you're using a custom domain and require a `CNAME` file, or if you require the use of a `.nojekyll` file, you can safely commit these files directly into deployment branch without them being overridden after each deployment.
---
### Debugging 🐝
By default the git commands are hidden from the logs. If you'd like to turn them on you can set the `ACTIONS_STEP_DEBUG` environment variable to true within the [Settings/Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets) menu. If you're using this action in your own project as a node module via yarn or npm **you may expose your secrets if you toggle this on in a production environment**. You can learn more about debugging GitHub actions [here](https://github.com/actions/toolkit/blob/master/docs/action-debugging.md).

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

/** If your project generates hashed files on build you can use this option to automatically delete them from the deployment branch with each deploy. This option can be toggled on by setting it to true. */
clean?: string | boolean
clean?: boolean | null
/** If you need to use CLEAN but you'd like to preserve certain files or folders you can use this option. */

@@ -22,4 +22,2 @@ cleanExclude?: string | string[]

commitMessage?: string
/** Unhides the Git commands from the function terminal. */
debug?: boolean | string
/** The default branch of the deployment. Similar to baseBranch if you're using this action as a module. */

@@ -34,3 +32,3 @@ defaultBranch?: string

/** Determines if the action is running in test mode or not. */
isTest?: string | undefined | null
isTest?: boolean | null
/** The git config name. */

@@ -44,4 +42,6 @@ name?: string

root?: string
/** Wipes the commit history from the deployment branch in favor of a single commit. */
singleCommit?: boolean | null
/** Set to true if you're using an ssh client in your build step. */
ssh?: string | boolean | null
ssh?: boolean | null
/** 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. */

@@ -62,8 +62,10 @@ targetFolder?: string

commitMessage: getInput('COMMIT_MESSAGE'),
clean: getInput('CLEAN'),
clean: !isNullOrUndefined(getInput('CLEAN'))
? getInput('CLEAN').toLowerCase() === 'true'
: false,
cleanExclude: getInput('CLEAN_EXCLUDE'),
debug: getInput('DEBUG'),
defaultBranch: process.env.GITHUB_SHA ? process.env.GITHUB_SHA : 'master',
isTest: process.env.UNIT_TEST,
ssh: getInput('SSH'),
isTest: process.env.UNIT_TEST
? process.env.UNIT_TEST.toLowerCase() === 'true'
: false,
email: !isNullOrUndefined(getInput('GIT_CONFIG_EMAIL'))

@@ -73,4 +75,5 @@ ? getInput('GIT_CONFIG_EMAIL')

? pusher.email
: `${process.env.GITHUB_ACTOR ||
'github-pages-deploy-action'}@users.noreply.github.com`,
: `${
process.env.GITHUB_ACTOR || 'github-pages-deploy-action'
}@users.noreply.github.com`,
gitHubToken: getInput('GITHUB_TOKEN'),

@@ -90,4 +93,10 @@ name: !isNullOrUndefined(getInput('GIT_CONFIG_NAME'))

root: '.',
singleCommit: !isNullOrUndefined(getInput('SINGLE_COMMIT'))
? getInput('SINGLE_COMMIT').toLowerCase() === 'true'
: false,
ssh: !isNullOrUndefined(getInput('SSH'))
? getInput('SSH').toLowerCase() === 'true'
: false,
targetFolder: getInput('TARGET_FOLDER'),
workspace: process.env.GITHUB_WORKSPACE || ''
}

@@ -0,1 +1,2 @@

import {isDebug} from '@actions/core'
import {exec} from '@actions/exec'

@@ -16,3 +17,3 @@

// Silences the input unless the INPUT_DEBUG flag is set.
silent: process.env.DEBUG_DEPLOY_ACTION ? false : true,
silent: isDebug() ? false : true,
cwd,

@@ -19,0 +20,0 @@ listeners: {

@@ -0,1 +1,2 @@

import {info} from '@actions/core'
import {ActionInterface} from './constants'

@@ -14,4 +15,4 @@ import {execute} from './execute'

console.log(`Deploying using ${action.tokenType}… 🔑`)
console.log('Configuring Git…')
info(`Deploying using ${action.tokenType}… 🔑`)
info('Configuring git…')

@@ -28,3 +29,3 @@ await execute(`git init`, action.workspace)

console.log('Git configured… 🔧')
info('Git configured… 🔧')
} catch (error) {

@@ -68,3 +69,3 @@ throw new Error(

console.log(`Creating the ${action.branch} branch…`)
info(`Creating the ${action.branch} branch…`)

@@ -79,3 +80,3 @@ await switchToBaseBranch(action)

await execute(
`git push ${action.repositoryPath} ${action.branch}`,
`git push --force ${action.repositoryPath} ${action.branch}`,
action.workspace

@@ -85,3 +86,3 @@ )

console.log(`Created the ${action.branch} branch… 🔧`)
info(`Created the ${action.branch} branch… 🔧`)
} catch (error) {

@@ -101,7 +102,14 @@ throw new Error(

const temporaryDeploymentBranch = 'gh-action-temp-deployment-branch'
console.log('Starting to commit changes…')
info('Starting to commit changes…')
try {
hasRequiredParameters(action)
const commitMessage = `${
!isNullOrUndefined(action.commitMessage)
? action.commitMessage
: `Deploying to ${action.branch} from ${action.baseBranch}`
} ${process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''} 🚀`
/*

@@ -141,3 +149,3 @@ Checks to see if the remote exists prior to deploying.

} catch {
console.log(
info(
'There was an error parsing your CLEAN_EXCLUDE items. Please refer to the README for more details. ❌'

@@ -175,3 +183,3 @@ )

if (!hasFilesToCommit && !action.isTest) {
console.log('There is nothing to commit. Exiting early… 📭')
info('There is nothing to commit. Exiting early… 📭')
return

@@ -190,9 +198,3 @@ }

await execute(
`git commit -m "${
!isNullOrUndefined(action.commitMessage)
? action.commitMessage
: `Deploying to ${action.branch} from ${action.baseBranch}`
} ${
process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''
} 🚀" --quiet`,
`git commit -m "${commitMessage}" --quiet`,
`${action.workspace}/${temporaryDeploymentDirectory}`

@@ -205,6 +207,33 @@ )

console.log(`Changes committed to the ${action.branch} branch… 📦`)
info(`Changes committed to the ${action.branch} branch… 📦`)
// Cleans up temporary files/folders and restores the git state.
console.log('Running post deployment cleanup jobs…')
info('Running post deployment cleanup jobs…')
if (action.singleCommit) {
await execute(`git fetch ${action.repositoryPath}`, action.workspace)
await execute(
`git checkout --orphan ${action.branch}-temp`,
`${action.workspace}/${temporaryDeploymentDirectory}`
)
await execute(
`git add --all .`,
`${action.workspace}/${temporaryDeploymentDirectory}`
)
await execute(
`git commit -m "${commitMessage}" --quiet`,
`${action.workspace}/${temporaryDeploymentDirectory}`
)
await execute(
`git branch -M ${action.branch}-temp ${action.branch}`,
`${action.workspace}/${temporaryDeploymentDirectory}`
)
await execute(
`git push origin ${action.branch} --force`,
`${action.workspace}/${temporaryDeploymentDirectory}`
)
info('Cleared git history… 🚿')
}
await execute(

@@ -211,0 +240,0 @@ `git checkout --progress --force ${action.defaultBranch}`,

@@ -1,2 +0,2 @@

import {exportVariable, setFailed} from '@actions/core'
import {info, setFailed} from '@actions/core'
import {action, ActionInterface} from './constants'

@@ -16,3 +16,3 @@ import {deploy, generateBranch, init} from './git'

try {
console.log('Checking configuration and starting deployment… 🚦')
info('Checking configuration and starting deployment… 🚦')

@@ -28,7 +28,2 @@ const settings = {

if (settings.debug) {
// Sets the debug flag if passed as an arguement.
exportVariable('DEBUG_DEPLOY_ACTION', 'debug')
}
await init(settings)

@@ -40,3 +35,3 @@ await deploy(settings)

} finally {
console.log(
info(
`${

@@ -43,0 +38,0 @@ errorState

@@ -1,2 +0,2 @@

import {getInput} from '@actions/core'
import {isDebug} from '@actions/core'
import {ActionInterface} from './constants'

@@ -22,6 +22,5 @@

? `git@github.com:${action.repositoryName}`
: `https://${action.accessToken ||
`x-access-token:${action.gitHubToken}`}@github.com/${
action.repositoryName
}.git`
: `https://${
action.accessToken || `x-access-token:${action.gitHubToken}`
}@github.com/${action.repositoryName}.git`

@@ -63,3 +62,3 @@ /* Checks for the required tokens and formatting. Throws an error if any case is matched. */

if (getInput('DEBUG')) {
if (isDebug()) {
// Data is unmasked in debug mode.

@@ -66,0 +65,0 @@ return value

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc