Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.1.6 🎉 #929

Merged
merged 34 commits into from Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
12a916d
Release 4.1.5 📣
JamesIves Aug 26, 2021
3aa6c63
Bump jest-circus from 27.0.6 to 27.1.0 (#849)
dependabot[bot] Aug 27, 2021
27151ca
Update README.md
JamesIves Sep 2, 2021
f14fccc
Bump eslint-plugin-prettier from 3.4.1 to 4.0.0 (#856)
dependabot[bot] Sep 9, 2021
08a0e51
Bump @typescript-eslint/parser from 4.29.3 to 4.31.0 (#860)
dependabot[bot] Sep 9, 2021
b10be47
Bump @typescript-eslint/eslint-plugin from 4.29.3 to 4.31.0 (#861)
dependabot[bot] Sep 9, 2021
36c5aca
Bump jest-circus from 27.1.0 to 27.1.1 (#863)
dependabot[bot] Sep 10, 2021
45c6b78
Bump @types/node from 16.7.2 to 16.9.1 (#867)
dependabot[bot] Sep 10, 2021
1cb0b12
Bump prettier from 2.3.2 to 2.4.0 (#865)
dependabot[bot] Sep 10, 2021
d271950
Bump tmpl from 1.0.4 to 1.0.5 (#883)
dependabot[bot] Sep 22, 2021
731032f
Bump ansi-regex from 5.0.0 to 5.0.1 (#885)
dependabot[bot] Sep 23, 2021
2632e43
Bump prettier from 2.4.0 to 2.4.1 (#873)
dependabot[bot] Sep 23, 2021
7a4ddfb
Bump eslint-plugin-jest from 24.4.0 to 24.4.2 (#876)
dependabot[bot] Sep 23, 2021
59e92ae
Bump @types/jest from 27.0.1 to 27.0.2 (#879)
dependabot[bot] Sep 23, 2021
283b2f0
Bump @typescript-eslint/parser from 4.31.0 to 4.31.2 (#880)
dependabot[bot] Sep 23, 2021
e11e86c
Bump @typescript-eslint/parser from 4.31.2 to 4.32.0 (#888)
dependabot[bot] Sep 30, 2021
21e2299
Bump @typescript-eslint/eslint-plugin from 4.31.0 to 4.32.0 (#889)
dependabot[bot] Oct 5, 2021
460c7b8
fix issue #866 - upgrading to typescript 4.4.3 (#896)
lucassabreu Oct 6, 2021
0a9e0bf
Bump @actions/core from 1.5.0 to 1.6.0 (#891)
dependabot[bot] Oct 6, 2021
7b05804
Bump jest-circus from 27.1.1 to 27.2.4 (#893)
dependabot[bot] Oct 6, 2021
07ef468
Bump eslint-plugin-jest from 24.4.2 to 24.5.2 (#897)
dependabot[bot] Oct 6, 2021
d7dacdf
Bump @typescript-eslint/eslint-plugin from 4.32.0 to 4.33.0 (#898)
dependabot[bot] Oct 6, 2021
f79ca10
Bump @typescript-eslint/parser from 4.32.0 to 4.33.0 (#899)
dependabot[bot] Oct 6, 2021
828cc96
Bump @types/node from 16.9.1 to 16.10.3 (#900)
dependabot[bot] Oct 6, 2021
aafee5b
Bump jest-circus from 27.2.4 to 27.2.5 (#901)
dependabot[bot] Oct 15, 2021
9b61dca
Bump typescript from 4.4.3 to 4.4.4 (#905)
dependabot[bot] Oct 16, 2021
f48e3e2
Bump @types/node from 16.10.3 to 16.11.1 (#911)
dependabot[bot] Oct 21, 2021
2e7d63d
Bump jest-circus from 27.2.5 to 27.3.1 (#914)
dependabot[bot] Nov 7, 2021
edc650f
Bump @types/node from 16.11.1 to 16.11.7 (#921)
dependabot[bot] Nov 12, 2021
cd707eb
Modified the link & linked security documentation (#924)
anushbhatia Nov 16, 2021
1d77ee0
Update .nvmrc (#927)
JamesIves Nov 17, 2021
bd6d73e
Allow Empty Git Email Configs (#926)
JamesIves Nov 17, 2021
755bf9f
Folder Permissions (#925)
JamesIves Nov 18, 2021
d8f62c5
Bump typescript from 4.4.4 to 4.5.2 (#928)
dependabot[bot] Nov 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
v12.18.4
v14.18.1
16 changes: 8 additions & 8 deletions README.md
Expand Up @@ -60,7 +60,7 @@ jobs:
npm run build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages # The branch the action should deploy to.
folder: build # The folder the action should deploy.
Expand All @@ -75,7 +75,7 @@ on:
- main
```

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

#### Install as a Node Module 📦

Expand Down Expand Up @@ -137,7 +137,7 @@ By default the action does not need any token configuration and uses the provide
| 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** |
| `git-config-email` | Allows you to customize the email that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the email in the GitHub context, followed by a generic noreply GitHub email. You can include an empty string value if you wish to omit this field altogether. | `with` | **No** |
| `repository-name` | Allows you to specify a different repository path so long as you have permissions to push to it. This should be formatted like so: `JamesIves/github-pages-deploy-action`. You'll need to use a PAT in the `token` input for this configuration option to work properly. | `with` | **No** |
| `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** |
Expand Down Expand Up @@ -178,7 +178,7 @@ With this configured you can then set the `ssh-key` part of the action to your p

```yml
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages
folder: site
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
npm run build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages
folder: build
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
name: site

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
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.
Expand All @@ -295,7 +295,7 @@ If you use a [container](https://help.github.com/en/actions/automating-your-work
apt-get update && apt-get install -y rsync

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

---
Expand Down Expand Up @@ -326,7 +326,7 @@ jobs:
npm run build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages
folder: build
Expand Down
24 changes: 12 additions & 12 deletions __tests__/git.test.ts
Expand Up @@ -80,7 +80,7 @@ describe('git', () => {
try {
await init(action)
} catch (error) {
expect(error.message).toBe(
expect(error instanceof Error && error.message).toBe(
'There was an error initializing the repository: Mocked throw ❌'
)
}
Expand Down Expand Up @@ -168,7 +168,7 @@ describe('git', () => {
const response = await deploy(action)

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(12)
expect(execute).toBeCalledTimes(13)
expect(rmRF).toBeCalledTimes(1)
expect(response).toBe(Status.SUCCESS)
})
Expand All @@ -191,7 +191,7 @@ describe('git', () => {
const response = await deploy(action)

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(11)
expect(execute).toBeCalledTimes(12)
expect(rmRF).toBeCalledTimes(1)
expect(response).toBe(Status.SUCCESS)
})
Expand All @@ -216,7 +216,7 @@ describe('git', () => {
await deploy(action)

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

Expand All @@ -240,7 +240,7 @@ describe('git', () => {
await deploy(action)

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

Expand All @@ -265,7 +265,7 @@ describe('git', () => {
await deploy(action)

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

Expand Down Expand Up @@ -296,7 +296,7 @@ describe('git', () => {
const response = await deploy(action)

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(12)
expect(execute).toBeCalledTimes(13)
expect(rmRF).toBeCalledTimes(1)
expect(fs.existsSync).toBeCalledTimes(2)
expect(response).toBe(Status.SUCCESS)
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('git', () => {
await deploy(action)

// Includes the call to generateWorktree
expect(execute).toBeCalledTimes(9)
expect(execute).toBeCalledTimes(10)
expect(rmRF).toBeCalledTimes(1)
})
})
Expand All @@ -353,7 +353,7 @@ describe('git', () => {
await deploy(action)

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

Expand All @@ -373,7 +373,7 @@ describe('git', () => {

await deploy(action)

expect(execute).toBeCalledTimes(9)
expect(execute).toBeCalledTimes(10)
expect(rmRF).toBeCalledTimes(1)
expect(mkdirP).toBeCalledTimes(1)
})
Expand All @@ -393,7 +393,7 @@ describe('git', () => {
})

const response = await deploy(action)
expect(execute).toBeCalledTimes(9)
expect(execute).toBeCalledTimes(10)
expect(rmRF).toBeCalledTimes(1)
expect(response).toBe(Status.SKIPPED)
})
Expand All @@ -419,7 +419,7 @@ describe('git', () => {
try {
await deploy(action)
} catch (error) {
expect(error.message).toBe(
expect(error instanceof Error && error.message).toBe(
'The deploy step encountered an error: Mocked throw ❌'
)
}
Expand Down
4 changes: 2 additions & 2 deletions __tests__/main.test.ts
Expand Up @@ -49,7 +49,7 @@ describe('main', () => {
debug: true
})
await run(action)
expect(execute).toBeCalledTimes(14)
expect(execute).toBeCalledTimes(15)
expect(rmRF).toBeCalledTimes(1)
expect(exportVariable).toBeCalledTimes(1)
})
Expand All @@ -69,7 +69,7 @@ describe('main', () => {
isTest: TestFlag.HAS_CHANGED_FILES
})
await run(action)
expect(execute).toBeCalledTimes(17)
expect(execute).toBeCalledTimes(18)
expect(rmRF).toBeCalledTimes(1)
expect(exportVariable).toBeCalledTimes(1)
})
Expand Down
2 changes: 1 addition & 1 deletion __tests__/ssh.test.ts
Expand Up @@ -133,7 +133,7 @@ describe('configureSSH', () => {
try {
await configureSSH(action)
} catch (error) {
expect(error.message).toBe(
expect(error instanceof Error && error.message).toBe(
'The ssh client configuration encountered an error: Mocked throw ❌'
)
}
Expand Down
51 changes: 45 additions & 6 deletions __tests__/util.test.ts
Expand Up @@ -6,7 +6,8 @@ import {
generateFolderPath,
suppressSensitiveInformation,
checkParameters,
stripProtocolFromUrl
stripProtocolFromUrl,
extractErrorMessage
} from '../src/util'

describe('util', () => {
Expand All @@ -30,6 +31,26 @@ describe('util', () => {
const value = ''
expect(isNullOrUndefined(value)).toBeTruthy()
})

it('should return true if the value is null (with allowEmptyString)', async () => {
const value = null
expect(isNullOrUndefined(value, true)).toBeTruthy()
})

it('should return true if the value is undefined (with allowEmptyString)', async () => {
const value = undefined
expect(isNullOrUndefined(value, true)).toBeTruthy()
})

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

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

describe('generateTokenType', () => {
Expand Down Expand Up @@ -222,7 +243,7 @@ describe('util', () => {
try {
checkParameters(action)
} catch (e) {
expect(e.message).toMatch(
expect(e instanceof Error && e.message).toMatch(
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true.'
)
}
Expand All @@ -242,7 +263,7 @@ describe('util', () => {
try {
checkParameters(action)
} catch (e) {
expect(e.message).toMatch(
expect(e instanceof Error && e.message).toMatch(
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true.'
)
}
Expand All @@ -262,7 +283,7 @@ describe('util', () => {
try {
checkParameters(action)
} catch (e) {
expect(e.message).toMatch('Branch is required.')
expect(e instanceof Error && e.message).toMatch('Branch is required.')
}
})

Expand All @@ -280,7 +301,7 @@ describe('util', () => {
try {
checkParameters(action)
} catch (e) {
expect(e.message).toMatch(
expect(e instanceof Error && e.message).toMatch(
'You must provide the action with a folder to deploy.'
)
}
Expand All @@ -301,7 +322,7 @@ describe('util', () => {
action.folderPath = generateFolderPath(action)
checkParameters(action)
} catch (e) {
expect(e.message).toMatch(
expect(e instanceof Error && e.message).toMatch(
`The directory you're trying to deploy named notARealFolder doesn't exist. Please double check the path and any prerequisite build scripts and try again. ❗`
)
}
Expand All @@ -327,4 +348,22 @@ describe('util', () => {
)
})
})

describe('extractErrorMessage', () => {
it('gets the message of a Error', () => {
expect(extractErrorMessage(new Error('a error message'))).toBe(
'a error message'
)
})

it('gets the message of a string', () => {
expect(extractErrorMessage('a error message')).toBe('a error message')
})

it('gets the message of a object', () => {
expect(extractErrorMessage({special: 'a error message'})).toBe(
`{"special":"a error message"}`
)
})
})
})
2 changes: 1 addition & 1 deletion __tests__/worktree.error.test.ts
Expand Up @@ -28,7 +28,7 @@ describe('generateWorktree', () => {
true
)
} catch (error) {
expect(error.message).toBe(
expect(error instanceof Error && error.message).toBe(
'There was an error creating the worktree: Mocked throw ❌'
)
}
Expand Down
22 changes: 11 additions & 11 deletions package.json
Expand Up @@ -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 <iam@jamesiv.es> (https://jamesiv.es)",
"version": "4.1.4",
"version": "4.1.5",
"license": "MIT",
"main": "lib/lib.js",
"types": "lib/lib.d.ts",
Expand Down Expand Up @@ -33,25 +33,25 @@
"deployment"
],
"dependencies": {
"@actions/core": "1.5.0",
"@actions/core": "1.6.0",
"@actions/exec": "1.1.0",
"@actions/github": "5.0.0",
"@actions/io": "1.1.1"
},
"devDependencies": {
"@types/jest": "27.0.1",
"@types/node": "16.7.2",
"@typescript-eslint/eslint-plugin": "4.29.3",
"@typescript-eslint/parser": "4.29.3",
"@types/jest": "27.0.2",
"@types/node": "16.11.7",
"@typescript-eslint/eslint-plugin": "4.33.0",
"@typescript-eslint/parser": "4.33.0",
"eslint": "7.32.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-jest": "24.4.0",
"eslint-plugin-prettier": "3.4.1",
"eslint-plugin-jest": "24.5.2",
"eslint-plugin-prettier": "4.0.0",
"jest": "26.6.3",
"jest-circus": "27.0.6",
"prettier": "2.3.2",
"jest-circus": "27.3.1",
"prettier": "2.4.1",
"rimraf": "3.0.2",
"ts-jest": "26.5.6",
"typescript": "4.3.5"
"typescript": "4.5.2"
}
}
2 changes: 1 addition & 1 deletion src/constants.ts
Expand Up @@ -95,7 +95,7 @@ export const action: ActionInterface = {
? stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
: 'github.com',
isTest: TestFlag.NONE,
email: !isNullOrUndefined(getInput('git-config-email'))
email: !isNullOrUndefined(getInput('git-config-email'), true)
? getInput('git-config-email')
: pusher && pusher.email
? pusher.email
Expand Down