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.1 to 4.1.2

.github/assets/icon.png

15

__tests__/git.test.ts

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

/* eslint-disable import/first */
// Initial env variable setup for tests.

@@ -172,3 +171,3 @@ process.env['INPUT_FOLDER'] = 'build'

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

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

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

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

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

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

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

@@ -361,3 +360,3 @@ })

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

@@ -382,3 +381,3 @@ })

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

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

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

@@ -406,0 +405,0 @@ expect(response).toBe(Status.SKIPPED)

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

/* eslint-disable import/first */
// Initial env variable setup for tests.

@@ -41,3 +40,3 @@ process.env['INPUT_FOLDER'] = 'build'

repositoryPath: 'JamesIves/github-pages-deploy-action',
folder: 'assets',
folder: '.github/assets',
branch: 'branch',

@@ -54,3 +53,3 @@ token: '123',

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

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

repositoryPath: 'JamesIves/github-pages-deploy-action',
folder: 'assets',
folder: '.github/assets',
branch: 'branch',

@@ -76,3 +75,3 @@ token: '123',

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

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

hostname: 'github.com',
folder: 'assets',
folder: '.github/assets',
branch: 'branch',

@@ -88,0 +87,0 @@ token: null,

// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/typescript-node
{
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "12"
}
},
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"dbaeumer.vscode-eslint"
],
"remoteUser": "node"
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "12"
}
},
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": ["dbaeumer.vscode-eslint"],
"remoteUser": "node"
}
{
"plugins": ["jest", "@typescript-eslint", "github"],
"extends": ["plugin:github/recommended"],
"plugins": ["jest", "@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",

@@ -13,55 +17,59 @@ "parserOptions": {

},
"env": {
"node": true,
"es6": true,
"jest/globals": true
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"Number": {
"message": "Use number instead",
"fixWith": "number"
},
"String": {
"message": "Use string instead",
"fixWith": "string"
},
"Boolean": {
"message": "Use boolean instead",
"fixWith": "boolean"
},
"Object": {
"message": "Use object instead",
"fixWith": "object"
},
"{}": {
"message": "Use object instead",
"fixWith": "object"
},
"Symbol": {
"message": "Use symbol instead",
"fixWith": "symbol"
}
}
}
],
"@typescript-eslint/array-type": ["error", {"default": "array"}],
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/naming-convention": [
"@typescript-eslint/explicit-function-return-type": "error",
"object-shorthand": ["error", "always"],
"prefer-destructuring": [
"error",
{
"selector": "default",
"format": ["camelCase", "UPPER_CASE", "StrictPascalCase"]
"array": false,
"object": true
},
{
"enforceForRenamedProperties": false
}
],
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error",
"no-console": "off",
"no-shadow": "off", // replaced by ts-eslint rule below
"@typescript-eslint/no-shadow": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
"no-console": ["error", {"allow": ["warn", "error"]}],
"no-alert": "error",
"no-debugger": "error"
}
}

@@ -5,4 +5,3 @@ ---

labels:
- bug
- triage ⚠️
---

@@ -13,11 +12,15 @@

## Describe the bug
<!-- Please provide a clear and concise description of what the bug is. -->
## Reproduction Steps
<!-- Steps to reproduce the behavior. -->
## Logs
<!-- Please provide your deployment logs and a link or sample to/of your workflow. If the error message isn't revealing the problem please set ACTIONS_STEP_DEBUG to true in your repository's secrets menu and run the workflow again. -->
## Additional Comments
<!--Add any other context about the problem here. -->
## Description
<!-- Provide a description of what your changes do. -->
## Testing Instructions
<!-- Give us step by step instructions on how to test your changes. -->
## Additional Notes
<!-- Anything else that will help us test the pull request. -->

@@ -9,4 +9,3 @@ {

"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
"arrowParens": "avoid"
}

@@ -17,18 +17,18 @@ # Contributor Covenant Code of Conduct

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

@@ -35,0 +35,0 @@ ## Our Responsibilities

# Contributing ✏️
When contributing to this repository, please first discuss the change you wish to make via issue,
When contributing to this repository, please first discuss the change you wish to make via issue,
[email, or any other method with the owners of this repository](https://jamesiv.es) before making a change. If you are planning to work on an issue that already exists please let us know before writing any code incase it's already in flight!
## Before Making a Pull Request 🎒
## Before Making a Pull Request 🎒
1. Ensure that you've tested your feature/change yourself. As the primary focus of this project is deployment, providing a link to a deployed repository using your branch is preferred. You can reference the forked action using your GitHub username, for example `yourname/github-pages-deplpy-action@dev`.
2. Ensure your change passes all of the integration tests.
3. Make sure you update the README if you've made a change that requires documentation.
3. Make sure you update the README if you've made a change that requires documentation.
4. When making a pull request, highlight any areas that may cause a breaking change so the maintainer can update the version number accordingly on the GitHub marketplace and package registries.
5. Make sure you've formatted and linted your code. You can do this by running `yarn format` and `yarn lint`.
5. Make sure you've formatted and linted your code. You can do this by running `yarn format` and `yarn lint`.
6. Fix or add any tests where applicable. You can run `yarn test` to run the suite. As this action is small in scope it's important that a high level of test coverage is maintained. All tests are written using [Jest](https://jestjs.io/).

@@ -35,3 +35,3 @@ 7. As this package is written in [TypeScript](https://www.typescriptlang.org/) please ensure all typing is accurate and the action compiles correctly by running `yarn build`.

Build the project:
Build the project:

@@ -53,4 +53,4 @@ ```

* [TypeScript](https://www.typescriptlang.org/)
* [Jest](https://jestjs.io/)
* [GitHub Actions Documentation](https://help.github.com/en/actions)
- [TypeScript](https://www.typescriptlang.org/)
- [Jest](https://jestjs.io/)
- [GitHub Actions Documentation](https://help.github.com/en/actions)

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

/// <reference types="node" />
/** Wrapper around the GitHub toolkit exec command which returns the output.

@@ -8,3 +9,3 @@ * Also allows you to easily toggle the current working directory.

*/
export declare function execute(cmd: string, cwd: string, silent: boolean): Promise<any>;
export declare function stdout(data: any): string | void;
export declare function execute(cmd: string, cwd: string, silent: boolean): Promise<string>;
export declare function stdout(data: Buffer | string): void;

@@ -11,6 +11,10 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.stdout = exports.execute = void 0;
const exec_1 = require("@actions/exec");
let output;
const buffer_1 = __importDefault(require("buffer"));
let output = '';
/** Wrapper around the GitHub toolkit exec command which returns the output.

@@ -39,4 +43,6 @@ * Also allows you to easily toggle the current working directory.

function stdout(data) {
output += data.toString().trim();
if (output.length < buffer_1.default.constants.MAX_STRING_LENGTH) {
output += data.toString().trim();
}
}
exports.stdout = stdout;

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

const branchExists = action.isTest & constants_1.TestFlag.HAS_REMOTE_BRANCH ||
(yield execute_1.execute(`git ls-remote --heads ${action.repositoryPath} ${action.branch}`, action.workspace, action.silent));
(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);

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

));
if (!hasFilesToCommit) {
if ((!action.singleCommit && !hasFilesToCommit) ||
// Ignores the case where single commit is true with a target folder to prevent incorrect early exiting.
(action.singleCommit && !action.targetFolder && !hasFilesToCommit)) {
return constants_1.Status.SKIPPED;

@@ -139,2 +141,7 @@ }

core_1.info('Running post deployment cleanup jobs… 🗑️');
if (!action.singleCommit) {
core_1.info(`Resetting branch and removing artifacts…`);
yield execute_1.execute(`git checkout -B ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield execute_1.execute(`git branch -D ${action.branch} --force`, action.workspace, action.silent);
}
yield execute_1.execute(`git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, action.silent);

@@ -141,0 +148,0 @@ yield io_1.rmRF(temporaryDeploymentDirectory);

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

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

@@ -9,2 +9,2 @@ import { ActionInterface } from './constants';

}
export declare function generateWorktree(action: ActionInterface, worktreedir: string, branchExists: boolean): Promise<void>;
export declare function generateWorktree(action: ActionInterface, worktreedir: string, branchExists: unknown): Promise<void>;

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

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

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

"lint": "eslint src/**/*.ts __tests__/**/*.ts",
"lint:format": "prettier --write './**/*.ts'"
"lint:format": "prettier --write './**/*.{ts,js,json,yml,md}' './*.{ts,js,json,yml,md}'"
},

@@ -38,14 +38,16 @@ "repository": {

"dependencies": {
"@actions/core": "1.2.6",
"@actions/core": "1.2.7",
"@actions/exec": "1.0.4",
"@actions/github": "4.0.0",
"@actions/io": "1.0.2"
"@actions/io": "1.1.0"
},
"devDependencies": {
"@types/jest": "26.0.22",
"@types/node": "14.14.37",
"eslint": "7.23.0",
"eslint-plugin-github": "4.1.2",
"eslint-plugin-jest": "24.3.2",
"eslint-plugin-prettier": "3.1.2",
"@types/jest": "26.0.23",
"@types/node": "15.0.2",
"@typescript-eslint/eslint-plugin": "4.22.1",
"@typescript-eslint/parser": "4.22.1",
"eslint": "7.26.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-jest": "24.3.6",
"eslint-plugin-prettier": "3.4.0",
"jest": "26.6.3",

@@ -55,5 +57,5 @@ "jest-circus": "26.6.3",

"rimraf": "3.0.2",
"ts-jest": "26.5.4",
"typescript": "4.2.3"
"ts-jest": "26.5.6",
"typescript": "4.2.4"
}
}
<p align="center">
<a href="https://github.com/marketplace/actions/deploy-to-github-pages">
<img alt="" width="300px" src="https://github.com/JamesIves/github-pages-deploy-action/raw/dev-v4/assets/icon.png">
<img alt="" width="200px" src="https://github.com/JamesIves/github-pages-deploy-action/raw/dev/.github/assets/icon.png">
</a>

@@ -38,3 +38,3 @@ </p>

<p align="center">
<img src="https://github.com/JamesIves/github-pages-deploy-action/raw/dev-v4/assets/screenshot.png">
<img src="https://github.com/JamesIves/github-pages-deploy-action/raw/dev/.github/assets/screenshot.png">
</p>

@@ -64,3 +64,3 @@

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
uses: JamesIves/github-pages-deploy-action@4.1.2
with:

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

branches:
- master
- main
```

@@ -85,3 +85,3 @@

If you'd like to use the functionality provided by this action in your own action you can install it using [yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/get-npm) by running the following commands. It's available on both the [npm](https://www.npmjs.com/package/@jamesives/github-pages-deploy-action) and [GitHub registry](https://github.com/JamesIves/github-pages-deploy-action/packages/229985).
If you'd like to use the functionality provided by this action in your own action you can install it using [yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/get-npm) by running the following commands. It's available on both the [npm](https://www.npmjs.com/package/@jamesives/github-pages-deploy-action) and [GitHub registry](https://github.com/JamesIves/github-pages-deploy-action/packages/229985).

@@ -99,3 +99,3 @@ ```

```javascript
import run from "github-pages-deploy-action";
import run from '@jamesives/github-pages-deploy-action'
```

@@ -106,15 +106,15 @@

```javascript
import run from "github-pages-deploy-action";
import run from '@jamesives/github-pages-deploy-action'
run({
token: process.env["ACCESS_TOKEN"],
branch: "gh-pages",
folder: "build",
repositoryName: "JamesIves/github-pages-deploy-action",
token: process.env['ACCESS_TOKEN'],
branch: 'gh-pages',
folder: 'build',
repositoryName: 'JamesIves/github-pages-deploy-action',
silent: true,
workspace: "src/project/location",
});
workspace: 'src/project/location'
})
```
For more information regarding the [action interface please click here](https://github.com/JamesIves/github-pages-deploy-action/blob/dev/src/constants.ts#L7).
For more information regarding the [action interface please click here](https://github.com/JamesIves/github-pages-deploy-action/blob/dev/src/constants.ts#L7).

@@ -129,5 +129,5 @@ ## Configuration 📁

| Key | Value Information | Type | Required |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `branch` | This is the branch you wish to deploy to, for example `gh-pages` or `docs`. | `with` | **Yes** |
| Key | Value Information | Type | Required |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `branch` | This is the branch you wish to deploy to, for example `gh-pages` or `docs`. | `with` | **Yes** |
| `folder` | The folder in your repository that you want to deploy. If your build script compiles into a directory named `build` you'd put it here. If you wish to deploy the root directory you can place a `.` here. You can also utilize absolute file paths by appending `~` to your folder path. | `with` | **Yes** |

@@ -137,22 +137,22 @@

| Key | Value Information | Type | Required |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | -------- |
| `token` | This option defaults to the repository scoped GitHub Token. However if you need more permissions for things such as deploying to another repository, you can add a Personal Access Token (PAT) here. This should be stored in the `secrets / with` menu **as a secret**. We recommend using a service account with the least permissions necessary and recommend when generating a new PAT that you select the least permission scopes necessary. [Learn more about creating and using encrypted secrets here.](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) | `with` | **No** |
| `ssh-key` | You can configure the action to deploy using SSH by setting this option to a private SSH key stored **as a secret**. It can also be set to `true` to use an existing SSH client configuration. For more detailed information on how to add your public/private ssh key pair please refer to the [Using a Deploy Key section of this README](https://github.com/JamesIves/github-pages-deploy-action/tree/dev#using-an-ssh-deploy-key-). | `with` | **No** |
| Key | Value Information | Type | Required |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `token` | This option defaults to the repository scoped GitHub Token. However if you need more permissions for things such as deploying to another repository, you can add a Personal Access Token (PAT) here. This should be stored in the `secrets / with` menu **as a secret**. We recommend using a service account with the least permissions necessary and recommend when generating a new PAT that you select the least permission scopes necessary. [Learn more about creating and using encrypted secrets here.](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) | `with` | **No** |
| `ssh-key` | You can configure the action to deploy using SSH by setting this option to a private SSH key stored **as a secret**. It can also be set to `true` to use an existing SSH client configuration. For more detailed information on how to add your public/private ssh key pair please refer to the [Using a Deploy Key section of this README](https://github.com/JamesIves/github-pages-deploy-action/tree/dev#using-an-ssh-deploy-key-). | `with` | **No** |
#### Optional Choices
| Key | Value Information | Type | Required |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `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 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** |
| `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** |
| `commit-message` | If you need to customize the commit message for an integration you can do so. | `with` | **No** |
| `clean` | If your project generates hashed files on build you can use this option to automatically delete them from the target folder on the deployment branch with each deploy. This option is turned on by default, and can be toggled off by setting it to `false`. | `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 contain each pattern as a single line in a multiline string. | `with` | **No** |
| `dry-run` | Do not actually push back, but use `--dry-run` on `git push` invocations instead. | `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** |
| `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 necessary to set this variable if you're using the node module. | `with` | **No** |
| Key | Value Information | Type | Required |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `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 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** |
| `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** |
| `commit-message` | If you need to customize the commit message for an integration you can do so. | `with` | **No** |
| `clean` | You can use this option to delete files from your deployment destination that no longer exist in your deployment source. One use case is if your project generates hashed files that vary from build to build. Using `clean` will not affect `.git`, `.github`, or `.ssh` directories. This option is turned on by default, and can be toggled off by setting it to `false`. | `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 contain each pattern as a single line in a multiline string. | `with` | **No** |
| `dry-run` | Do not actually push back, but use `--dry-run` on `git push` invocations instead. | `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** |
| `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 necessary to set this variable if you're using the node module. | `with` | **No** |

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

| Status | Description |
| ------------- |-------------|
| `success` | The `success` status indicates that the action was able to successfully deploy to the branch. |
| `failed` | The `failed` status indicates that the action encountered an error while trying to deploy. |
| `skipped` | The `skipped` status indicates that the action exited early as there was nothing new to deploy. |
| Status | Description |
| --------- | ----------------------------------------------------------------------------------------------- |
| `success` | The `success` status indicates that the action was able to successfully deploy to the branch. |
| `failed` | The `failed` status indicates that the action encountered an error while trying to deploy. |
| `skipped` | The `skipped` status indicates that the action exited early as there was nothing new to deploy. |

@@ -190,3 +190,3 @@ This value is also set as a step output as `deployment-status`.

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
uses: JamesIves/github-pages-deploy-action@4.1.2
with:

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

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
uses: JamesIves/github-pages-deploy-action@4.1.2
with:

@@ -288,7 +288,7 @@ branch: gh-pages

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
uses: JamesIves/github-pages-deploy-action@4.1.2
with:
token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: "site" # The deployment folder should match the name of the artifact. Even though our project builds into the 'build' folder the artifact name of 'site' must be placed here.
folder: 'site' # The deployment folder should match the name of the artifact. Even though our project builds into the 'build' folder the artifact name of 'site' must be placed here.
```

@@ -311,3 +311,3 @@

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
uses: JamesIves/github-pages-deploy-action@4.1.2
```

@@ -343,3 +343,3 @@

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
uses: JamesIves/github-pages-deploy-action@4.1.2
with:

@@ -353,2 +353,3 @@ branch: gh-pages

```
</p>

@@ -363,4 +364,4 @@ </details>

This project would not be possible without all of our fantastic [contributors](https://github.com/JamesIves/github-pages-deploy-action/graphs/contributors).
This project would not be possible without all of our fantastic [contributors](https://github.com/JamesIves/github-pages-deploy-action/graphs/contributors) and [sponsors](https://github.com/sponsors/JamesIves). If you'd like to support the maintenance and upkeep of this project you can [donate via GitHub Sponsors](https://github.com/sponsors/JamesIves).
If you'd like to support the maintenance and upkeep of this project you can [donate via GitHub Sponsors](https://github.com/sponsors/JamesIves). This project is distributed under the [MIT](https://github.com/JamesIves/github-pages-deploy-action/blob/dev/LICENSE) license, and the project logo was created by [Paganini](https://twitter.com/paganiniart).
<!-- sponsors --><!-- sponsors -->
import {exec} from '@actions/exec'
import buffer from 'buffer'
let output: string
let output = ''

@@ -16,3 +17,3 @@ /** Wrapper around the GitHub toolkit exec command which returns the output.

silent: boolean
): Promise<any> {
): Promise<string> {
output = ''

@@ -32,4 +33,6 @@

export function stdout(data: any): string | void {
output += data.toString().trim()
export function stdout(data: Buffer | string): void {
if (output.length < buffer.constants.MAX_STRING_LENGTH) {
output += data.toString().trim()
}
}

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

(await execute(
`git ls-remote --heads ${action.repositoryPath} ${action.branch}`,
`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`,
action.workspace,

@@ -155,3 +155,5 @@ action.silent

: `git status --porcelain`
info(`Checking if there are files to commit…`)
const hasFilesToCommit =

@@ -165,3 +167,7 @@ action.isTest & TestFlag.HAS_CHANGED_FILES ||

if (!hasFilesToCommit) {
if (
(!action.singleCommit && !hasFilesToCommit) ||
// Ignores the case where single commit is true with a target folder to prevent incorrect early exiting.
(action.singleCommit && !action.targetFolder && !hasFilesToCommit)
) {
return Status.SKIPPED

@@ -207,2 +213,18 @@ }

info('Running post deployment cleanup jobs… 🗑️')
if (!action.singleCommit) {
info(`Resetting branch and removing artifacts…`)
await execute(
`git checkout -B ${temporaryDeploymentBranch}`,
`${action.workspace}/${temporaryDeploymentDirectory}`,
action.silent
)
await execute(
`git branch -D ${action.branch} --force`,
action.workspace,
action.silent
)
}
await execute(

@@ -213,4 +235,5 @@ `git worktree remove ${temporaryDeploymentDirectory} --force`,

)
await rmRF(temporaryDeploymentDirectory)
}
}

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

/* Utility function that checks to see if a value is undefined or not. */
export const isNullOrUndefined = (value: any): boolean =>
export const isNullOrUndefined = (value: unknown): boolean =>
typeof value === 'undefined' || value === null || value === ''

@@ -14,0 +14,0 @@

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

worktreedir: string,
branchExists: boolean
branchExists: unknown
): Promise<void> {

@@ -31,0 +31,0 @@ try {

{
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"target": "es6",
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true
},
"exclude": ["node_modules", "**/*.test.ts"]
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "."
},
"exclude": ["node_modules"]
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "."
},
"exclude": ["node_modules"]
}

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

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