Skip to content

Commit 5acd2db

Browse files
committed
Specification of empty git config <>
1 parent 0b8cf6d commit 5acd2db

File tree

5 files changed

+5
-30
lines changed

5 files changed

+5
-30
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ By default the action does not need any token configuration and uses the provide
137137
| Key | Value Information | Type | Required |
138138
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
139139
| `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** |
140-
| `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** |
140+
| `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 `<>` for the value if you wish to omit this field altogether and push the commits without an email. | `with` | **No** |
141141
| `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** |
142142
| `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** |
143143
| `commit-message` | If you need to customize the commit message for an integration you can do so. | `with` | **No** |

__tests__/util.test.ts

-20
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,6 @@ describe('util', () => {
3131
const value = ''
3232
expect(isNullOrUndefined(value)).toBeTruthy()
3333
})
34-
35-
it('should return true if the value is null (with allowEmptyString)', async () => {
36-
const value = null
37-
expect(isNullOrUndefined(value, true)).toBeTruthy()
38-
})
39-
40-
it('should return true if the value is undefined (with allowEmptyString)', async () => {
41-
const value = undefined
42-
expect(isNullOrUndefined(value, true)).toBeTruthy()
43-
})
44-
45-
it('should return false if the value is defined (with allowEmptyString)', async () => {
46-
const value = 'montezuma'
47-
expect(isNullOrUndefined(value, true)).toBeFalsy()
48-
})
49-
50-
it('should return false if the value is empty string (with allowEmptyString)', async () => {
51-
const value = ''
52-
expect(isNullOrUndefined(value, true)).toBeFalsy()
53-
})
5434
})
5535

5636
describe('generateTokenType', () => {

src/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const action: ActionInterface = {
9595
? stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
9696
: 'github.com',
9797
isTest: TestFlag.NONE,
98-
email: !isNullOrUndefined(getInput('git-config-email'), true)
98+
email: !isNullOrUndefined(getInput('git-config-email'))
9999
? getInput('git-config-email')
100100
: pusher && pusher.email
101101
? pusher.email

src/git.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function init(action: ActionInterface): Promise<void | Error> {
2222
action.silent
2323
)
2424
await execute(
25-
`git config user.email "${action.email ? action.email : '<>'}"`,
25+
`git config user.email "${action.email}"`,
2626
action.workspace,
2727
action.silent
2828
)

src/util.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ const replaceAll = (input: string, find: string, replace: string): string =>
99

1010
/* Utility function that checks to see if a value is undefined or not.
1111
If allowEmptyString is passed the parameter is allowed to contain an empty string as a valid parameter. */
12-
export const isNullOrUndefined = (
13-
value: unknown,
14-
allowEmptyString = false
15-
): boolean =>
16-
allowEmptyString
17-
? typeof value === 'undefined' || value === null
18-
: typeof value === 'undefined' || value === null || value === ''
12+
export const isNullOrUndefined = (value: unknown): boolean =>
13+
typeof value === 'undefined' || value === null || value === ''
1914

2015
/* Generates a token type used for the action. */
2116
export const generateTokenType = (action: ActionInterface): string =>

0 commit comments

Comments
 (0)