Skip to content

Commit a7cf017

Browse files
authored
Ignore Case (#987)
* Update git.ts * Formatting * formatting * Tests
1 parent 43e20fe commit a7cf017

File tree

7 files changed

+42
-15
lines changed

7 files changed

+42
-15
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ updates:
1212
schedule:
1313
interval: daily
1414
time: '10:00'
15-
open-pull-requests-limit: 10
15+
open-pull-requests-limit: 10

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ jobs:
218218
integration-container,
219219
integration-ssh,
220220
integration-ssh-third-party-client,
221-
integration-env
221+
integration-env,
222222
]
223223
runs-on: ubuntu-latest
224224
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ on:
7575
- main
7676
```
7777

78-
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).
78+
It's recommended that you use [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically) 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).
7979

8080
#### Install as a Node Module 📦
8181

__tests__/git.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('git', () => {
5555
})
5656

5757
await init(action)
58-
expect(execute).toBeCalledTimes(5)
58+
expect(execute).toBeCalledTimes(6)
5959
})
6060

6161
it('should catch when a function throws an error', async () => {
@@ -102,7 +102,7 @@ describe('git', () => {
102102
})
103103

104104
await init(action)
105-
expect(execute).toBeCalledTimes(5)
105+
expect(execute).toBeCalledTimes(6)
106106
})
107107

108108
it('should not unset git config if a user is using ssh', async () => {
@@ -124,7 +124,7 @@ describe('git', () => {
124124
})
125125

126126
await init(action)
127-
expect(execute).toBeCalledTimes(4)
127+
expect(execute).toBeCalledTimes(5)
128128

129129
process.env.CI = undefined
130130
})
@@ -145,7 +145,7 @@ describe('git', () => {
145145
})
146146

147147
await init(action)
148-
expect(execute).toBeCalledTimes(5)
148+
expect(execute).toBeCalledTimes(6)
149149
})
150150
})
151151

__tests__/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('main', () => {
5050
debug: true
5151
})
5252
await run(action)
53-
expect(execute).toBeCalledTimes(15)
53+
expect(execute).toBeCalledTimes(16)
5454
expect(rmRF).toBeCalledTimes(1)
5555
expect(exportVariable).toBeCalledTimes(1)
5656
})
@@ -70,7 +70,7 @@ describe('main', () => {
7070
isTest: TestFlag.HAS_CHANGED_FILES
7171
})
7272
await run(action)
73-
expect(execute).toBeCalledTimes(18)
73+
expect(execute).toBeCalledTimes(19)
7474
expect(rmRF).toBeCalledTimes(1)
7575
expect(exportVariable).toBeCalledTimes(1)
7676
})

src/constants.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,12 @@ export enum OperatingSystems {
157157
}
158158

159159
export const SupportedOperatingSystems = [OperatingSystems.LINUX]
160+
161+
/* Excluded files. */
162+
export enum DefaultExcludedFiles {
163+
CNAME = 'CNAME',
164+
NOJEKYLL = '.nojekyll',
165+
SSH = '.ssh',
166+
GIT = '.git',
167+
GITHUB = '.github'
168+
}

src/git.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import {info} from '@actions/core'
22
import {mkdirP, rmRF} from '@actions/io'
33
import fs from 'fs'
4-
import {ActionInterface, Status, TestFlag} from './constants'
4+
import {
5+
ActionInterface,
6+
DefaultExcludedFiles,
7+
Status,
8+
TestFlag
9+
} from './constants'
510
import {execute} from './execute'
611
import {generateWorktree} from './worktree'
712
import {
@@ -21,12 +26,19 @@ export async function init(action: ActionInterface): Promise<void | Error> {
2126
action.workspace,
2227
action.silent
2328
)
29+
2430
await execute(
2531
`git config user.email "${action.email}"`,
2632
action.workspace,
2733
action.silent
2834
)
2935

36+
await execute(
37+
`git config core.ignorecase false`,
38+
action.workspace,
39+
action.silent
40+
)
41+
3042
try {
3143
if ((process.env.CI && !action.sshKey) || action.isTest) {
3244
/* Ensures that previously set Git configs do not interfere with the deployment.
@@ -129,16 +141,22 @@ export async function deploy(action: ActionInterface): Promise<Status> {
129141
} ${
130142
action.clean
131143
? `--delete ${excludes} ${
132-
!fs.existsSync(`${action.folderPath}/CNAME`)
133-
? '--exclude CNAME'
144+
!fs.existsSync(
145+
`${action.folderPath}/${DefaultExcludedFiles.CNAME}`
146+
)
147+
? `--exclude ${DefaultExcludedFiles.CNAME}`
134148
: ''
135149
} ${
136-
!fs.existsSync(`${action.folderPath}/.nojekyll`)
137-
? '--exclude .nojekyll'
150+
!fs.existsSync(
151+
`${action.folderPath}/${DefaultExcludedFiles.NOJEKYLL}`
152+
)
153+
? `--exclude ${DefaultExcludedFiles.NOJEKYLL}`
138154
: ''
139155
}`
140156
: ''
141-
} --exclude .ssh --exclude .git --exclude .github ${
157+
} --exclude ${DefaultExcludedFiles.SSH} --exclude ${
158+
DefaultExcludedFiles.GIT
159+
} --exclude ${DefaultExcludedFiles.GITHUB} ${
142160
action.folderPath === action.workspace
143161
? `--exclude ${temporaryDeploymentDirectory}`
144162
: ''

0 commit comments

Comments
 (0)