From c8a432517a25de392f8cc0a90fb6c7c2c416a6c2 Mon Sep 17 00:00:00 2001 From: James Ives Date: Sat, 12 Sep 2020 22:54:00 +0000 Subject: [PATCH 01/12] =?UTF-8?q?Release=203.6.1=20=F0=9F=93=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6153900f..ed9cb488 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@jamesives/github-pages-deploy-action", "description": "GitHub action for building a project and deploying it to GitHub pages.", "author": "James Ives (https://jamesiv.es)", - "version": "3.6.0", + "version": "3.6.1", "license": "MIT", "main": "lib/lib.js", "types": "lib/lib.d.ts", From 0e70ab21c6031887fc954ae6e8e8bffa87ad1475 Mon Sep 17 00:00:00 2001 From: James Ives Date: Sat, 12 Sep 2020 18:57:20 -0400 Subject: [PATCH 02/12] Update integration.yml --- .github/workflows/integration.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 47f0ae0f..6eec93f8 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -25,7 +25,6 @@ jobs: FOLDER: integration BASE_BRANCH: dev TARGET_FOLDER: cat/montezuma - LFS: true GIT_CONFIG_NAME: Montezuma GIT_CONFIG_EMAIL: montezuma@jamesiv.es @@ -52,7 +51,6 @@ jobs: BRANCH: gh-pages FOLDER: integration BASE_BRANCH: dev - LFS: true TARGET_FOLDER: cat/montezuma2 - name: Cleanup Generated Branch From d67c49add0cfa41bf84f3cb0bf76b17f8e1fe50f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 16 Sep 2020 12:06:19 -0400 Subject: [PATCH 03/12] Bump prettier from 2.1.1 to 2.1.2 (#425) Bumps [prettier](https://github.com/prettier/prettier) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.1.1...2.1.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ed9cb488..418173b1 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "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", "typescript": "3.9.7" } diff --git a/yarn.lock b/yarn.lock index 846bd820..6a6e0b9b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4143,9 +4143,9 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.1.1, prettier@>=1.12.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6" +prettier@2.1.2, prettier@>=1.12.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" pretty-format@^25.2.1, pretty-format@^25.5.0: version "25.5.0" From e904db7977926c792ca24fd6e6a1b10a5a1a0d93 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 16 Sep 2020 12:06:37 -0400 Subject: [PATCH 04/12] Bump @types/node from 14.10.1 to 14.10.2 (#424) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.10.1 to 14.10.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 418173b1..cce8fe3e 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "devDependencies": { "@types/jest": "26.0.13", - "@types/node": "14.10.1", + "@types/node": "14.10.2", "eslint": "7.8.1", "eslint-plugin-github": "3.4.1", "eslint-plugin-jest": "24.0.0", diff --git a/yarn.lock b/yarn.lock index 6a6e0b9b..f51eba2a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -830,9 +830,9 @@ version "7.0.4" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" -"@types/node@*", "@types/node@14.10.1", "@types/node@>= 8": - version "14.10.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.10.1.tgz#cc323bad8e8a533d4822f45ce4e5326f36e42177" +"@types/node@*", "@types/node@14.10.2", "@types/node@>= 8": + version "14.10.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.10.2.tgz#9b47a2c8e4dabd4db73b57e750b24af689600514" "@types/normalize-package-data@^2.4.0": version "2.4.0" From cb4715b504df905671407890bba8465f8036c82b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 16 Sep 2020 12:06:47 -0400 Subject: [PATCH 05/12] Bump eslint-plugin-jest from 24.0.0 to 24.0.1 (#423) Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 24.0.0 to 24.0.1. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v24.0.0...v24.0.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index cce8fe3e..49d02db1 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@types/node": "14.10.2", "eslint": "7.8.1", "eslint-plugin-github": "3.4.1", - "eslint-plugin-jest": "24.0.0", + "eslint-plugin-jest": "24.0.1", "eslint-plugin-prettier": "^3.1.2", "jest": "25.5.4", "jest-circus": "26.4.2", diff --git a/yarn.lock b/yarn.lock index f51eba2a..4abce910 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1865,9 +1865,9 @@ eslint-plugin-import@>=2.18.2: read-pkg-up "^2.0.0" resolve "^1.12.0" -eslint-plugin-jest@24.0.0: - version "24.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.0.0.tgz#6b1c460c529104c7d16d889e76fe708b281c4d14" +eslint-plugin-jest@24.0.1: + version "24.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.0.1.tgz#ad5e091d47cf895e15dc115e18f98471135a334f" dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" From 66efb6e4ecb681377f10990c623b337d39379874 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 16 Sep 2020 13:31:29 -0400 Subject: [PATCH 06/12] Bump eslint from 7.8.1 to 7.9.0 (#422) Bumps [eslint](https://github.com/eslint/eslint) from 7.8.1 to 7.9.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.8.1...v7.9.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 20 +++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 49d02db1..233e7274 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "devDependencies": { "@types/jest": "26.0.13", "@types/node": "14.10.2", - "eslint": "7.8.1", + "eslint": "7.9.0", "eslint-plugin-github": "3.4.1", "eslint-plugin-jest": "24.0.1", "eslint-plugin-prettier": "^3.1.2", diff --git a/yarn.lock b/yarn.lock index 4abce910..da864cb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1957,9 +1957,9 @@ eslint-visitor-keys@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" -eslint@7.8.1: - version "7.8.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.8.1.tgz#e59de3573fb6a5be8ff526c791571646d124a8fa" +eslint@7.9.0: + version "7.9.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.9.0.tgz#522aeccc5c3a19017cf0cb46ebfd660a79acf337" dependencies: "@babel/code-frame" "^7.0.0" "@eslint/eslintrc" "^0.1.3" @@ -2313,13 +2313,7 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -glob-parent@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" - dependencies: - is-glob "^4.0.1" - -glob-parent@^5.1.0: +glob-parent@^5.0.0, glob-parent@^5.1.0: version "5.1.1" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" dependencies: @@ -2498,11 +2492,7 @@ ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" -ignore@^5.0.5: - version "5.1.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" - -ignore@^5.1.4: +ignore@^5.0.5, ignore@^5.1.4: version "5.1.8" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" From 6638f45b1d893787a25bfe2d972322249beabf5e Mon Sep 17 00:00:00 2001 From: Shahzeb Siddiqui Date: Tue, 22 Sep 2020 21:09:37 -0400 Subject: [PATCH 07/12] spelling error (#430) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 534de5ea..978fb844 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ In addition to the deployment options you must also configure the following. | `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** | | `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** | | `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** | With the action correctly configured you should see the workflow trigger the deployment under the configured conditions. From ee94d725899dc5769fba583139789466f52dff3c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 25 Sep 2020 20:34:01 -0400 Subject: [PATCH 08/12] Bump @actions/core from 1.2.5 to 1.2.6 (#434) Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/actions/toolkit/releases) - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 233e7274..34a227cb 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "deployment" ], "dependencies": { - "@actions/core": "1.2.5", + "@actions/core": "1.2.6", "@actions/exec": "1.0.4", "@actions/github": "4.0.0", "@actions/io": "1.0.2" diff --git a/yarn.lock b/yarn.lock index da864cb9..733e4951 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,9 +2,9 @@ # yarn lockfile v1 -"@actions/core@1.2.5": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.5.tgz#fa57bf8c07a38191e243beb9ea9d8368c1cb02c8" +"@actions/core@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09" "@actions/exec@1.0.4": version "1.0.4" From 9266f90c3bad859b5ab11bfd476162baae0b5600 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 25 Sep 2020 20:34:46 -0400 Subject: [PATCH 09/12] Bump @types/node from 14.10.2 to 14.11.2 (#431) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.10.2 to 14.11.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 34a227cb..abb322c0 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "devDependencies": { "@types/jest": "26.0.13", - "@types/node": "14.10.2", + "@types/node": "14.11.2", "eslint": "7.9.0", "eslint-plugin-github": "3.4.1", "eslint-plugin-jest": "24.0.1", diff --git a/yarn.lock b/yarn.lock index 733e4951..3895e261 100644 --- a/yarn.lock +++ b/yarn.lock @@ -830,9 +830,9 @@ version "7.0.4" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" -"@types/node@*", "@types/node@14.10.2", "@types/node@>= 8": - version "14.10.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.10.2.tgz#9b47a2c8e4dabd4db73b57e750b24af689600514" +"@types/node@*", "@types/node@14.11.2", "@types/node@>= 8": + version "14.11.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.11.2.tgz#2de1ed6670439387da1c9f549a2ade2b0a799256" "@types/normalize-package-data@^2.4.0": version "2.4.0" From e9d2b16b62e1472e4fe445fd643d4f65deb16c04 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 25 Sep 2020 20:34:55 -0400 Subject: [PATCH 10/12] Bump eslint-plugin-jest from 24.0.1 to 24.0.2 (#432) Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 24.0.1 to 24.0.2. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v24.0.1...v24.0.2) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index abb322c0..c128c739 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@types/node": "14.11.2", "eslint": "7.9.0", "eslint-plugin-github": "3.4.1", - "eslint-plugin-jest": "24.0.1", + "eslint-plugin-jest": "24.0.2", "eslint-plugin-prettier": "^3.1.2", "jest": "25.5.4", "jest-circus": "26.4.2", diff --git a/yarn.lock b/yarn.lock index 3895e261..c03c6fbe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1865,9 +1865,9 @@ eslint-plugin-import@>=2.18.2: read-pkg-up "^2.0.0" resolve "^1.12.0" -eslint-plugin-jest@24.0.1: - version "24.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.0.1.tgz#ad5e091d47cf895e15dc115e18f98471135a334f" +eslint-plugin-jest@24.0.2: + version "24.0.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.0.2.tgz#4bf0fcdc86289d702a7dacb430b4363482af773b" dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" From b8efd660d9cb5d0b499689df03cfe505a328d6b2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 27 Sep 2020 13:33:55 -0400 Subject: [PATCH 11/12] Bump @types/jest from 26.0.13 to 26.0.14 (#427) Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.13 to 26.0.14. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c128c739..006eb8ff 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@actions/io": "1.0.2" }, "devDependencies": { - "@types/jest": "26.0.13", + "@types/jest": "26.0.14", "@types/node": "14.11.2", "eslint": "7.9.0", "eslint-plugin-github": "3.4.1", diff --git a/yarn.lock b/yarn.lock index c03c6fbe..928b2f28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -819,9 +819,9 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@26.0.13": - version "26.0.13" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.13.tgz#5a7b9d5312f5dd521a38329c38ee9d3802a0b85e" +"@types/jest@26.0.14": + version "26.0.14" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.14.tgz#078695f8f65cb55c5a98450d65083b2b73e5a3f3" dependencies: jest-diff "^25.2.1" pretty-format "^25.2.1" From 8912f4fdb3401df34200010116d4de0394db02e8 Mon Sep 17 00:00:00 2001 From: James Ives Date: Sun, 27 Sep 2020 14:37:43 -0400 Subject: [PATCH 12/12] Stash / Remote Changes (#435) * Preservation Changes * Update git.ts * Makes adjustments --- README.md | 1 + __tests__/git.test.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ action.yml | 4 ++++ src/constants.ts | 5 +++++ src/git.ts | 27 ++++++++++++++++++++++++++- 5 files changed, 79 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 978fb844..b25465c1 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ In addition to the deployment options you must also configure the following. | `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** | | `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 necessary to set this variable if you're using the node module. | `with` | **No** | diff --git a/__tests__/git.test.ts b/__tests__/git.test.ts index f0eec7e2..0f2a0a41 100644 --- a/__tests__/git.test.ts +++ b/__tests__/git.test.ts @@ -241,6 +241,26 @@ describe('git', () => { expect(execute).toBeCalledTimes(6) }) + + 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) + }) }) describe('generateBranch', () => { @@ -364,6 +384,29 @@ describe('git', () => { expect(response).toBe(Status.SUCCESS) }) + 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 () => { Object.assign(action, { silent: false, diff --git a/action.yml b/action.yml index 373a0624..e2d30ae9 100644 --- a/action.yml +++ b/action.yml @@ -77,6 +77,10 @@ inputs: description: "Silences the action output preventing it from displaying git messages." required: false + PRESERVE: + description: "Preserves and restores any workspace changes prior to deployment." + required: false + outputs: DEPLOYMENT_STATUS: description: 'The status of the deployment that indicates if the run failed or passed. Possible outputs include: success|failed|skipped' diff --git a/src/constants.ts b/src/constants.ts index 2ee97de5..46eaaf5d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -32,6 +32,8 @@ export interface ActionInterface { lfs?: boolean | null /** The git config name. */ 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. */ repositoryName?: string /** The fully qualified repositpory path, this gets auto generated if repositoryName is provided. */ @@ -85,6 +87,9 @@ export const action: ActionInterface = { : process.env.GITHUB_ACTOR ? process.env.GITHUB_ACTOR : 'GitHub Pages Deploy Action', + preserve: !isNullOrUndefined(getInput('PRESERVE')) + ? getInput('PRESERVE').toLowerCase() === 'true' + : false, repositoryName: !isNullOrUndefined(getInput('REPOSITORY_NAME')) ? getInput('REPOSITORY_NAME') : repository && repository.full_name diff --git a/src/git.ts b/src/git.ts index a8c13ac5..05853bac 100644 --- a/src/git.ts +++ b/src/git.ts @@ -29,12 +29,25 @@ export async function init(action: ActionInterface): Promise { action.silent ) - await execute(`git remote rm origin`, action.workspace, action.silent) + try { + await execute(`git remote rm origin`, action.workspace, action.silent) + } finally { + if (action.isTest) { + info('Attempted to remove origin…') + } + } + await execute( `git remote add origin ${action.repositoryPath}`, action.workspace, action.silent ) + + if (action.preserve) { + info(`Stashing workspace changes… ⬆️`) + await execute(`git stash`, action.workspace, action.silent) + } + await execute( `git fetch --no-recurse-submodules`, action.workspace, @@ -165,6 +178,18 @@ export async function deploy(action: ActionInterface): Promise { ) } + if (action.preserve) { + info(`Applying stashed workspace changes… ⬆️`) + + try { + await execute(`git stash apply`, action.workspace, action.silent) + } finally { + if (action.isTest) { + info('Attempted to apply stash…') + } + } + } + await execute( `git worktree add --checkout ${temporaryDeploymentDirectory} origin/${action.branch}`, action.workspace,