Skip to content

Commit

Permalink
Ignore Case (#987)
Browse files Browse the repository at this point in the history
* Update git.ts

* Formatting

* formatting

* Tests
  • Loading branch information
JamesIves authored Jan 6, 2022
1 parent 43e20fe commit a7cf017
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ updates:
schedule:
interval: daily
time: '10:00'
open-pull-requests-limit: 10
open-pull-requests-limit: 10
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ jobs:
integration-container,
integration-ssh,
integration-ssh-third-party-client,
integration-env
integration-env,
]
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ on:
- main
```

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).
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).

#### Install as a Node Module 📦

Expand Down
8 changes: 4 additions & 4 deletions __tests__/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('git', () => {
})

await init(action)
expect(execute).toBeCalledTimes(5)
expect(execute).toBeCalledTimes(6)
})

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

await init(action)
expect(execute).toBeCalledTimes(5)
expect(execute).toBeCalledTimes(6)
})

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

await init(action)
expect(execute).toBeCalledTimes(4)
expect(execute).toBeCalledTimes(5)

process.env.CI = undefined
})
Expand All @@ -145,7 +145,7 @@ describe('git', () => {
})

await init(action)
expect(execute).toBeCalledTimes(5)
expect(execute).toBeCalledTimes(6)
})
})

Expand Down
4 changes: 2 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('main', () => {
debug: true
})
await run(action)
expect(execute).toBeCalledTimes(15)
expect(execute).toBeCalledTimes(16)
expect(rmRF).toBeCalledTimes(1)
expect(exportVariable).toBeCalledTimes(1)
})
Expand All @@ -70,7 +70,7 @@ describe('main', () => {
isTest: TestFlag.HAS_CHANGED_FILES
})
await run(action)
expect(execute).toBeCalledTimes(18)
expect(execute).toBeCalledTimes(19)
expect(rmRF).toBeCalledTimes(1)
expect(exportVariable).toBeCalledTimes(1)
})
Expand Down
9 changes: 9 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,12 @@ export enum OperatingSystems {
}

export const SupportedOperatingSystems = [OperatingSystems.LINUX]

/* Excluded files. */
export enum DefaultExcludedFiles {
CNAME = 'CNAME',
NOJEKYLL = '.nojekyll',
SSH = '.ssh',
GIT = '.git',
GITHUB = '.github'
}
30 changes: 24 additions & 6 deletions src/git.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import {info} from '@actions/core'
import {mkdirP, rmRF} from '@actions/io'
import fs from 'fs'
import {ActionInterface, Status, TestFlag} from './constants'
import {
ActionInterface,
DefaultExcludedFiles,
Status,
TestFlag
} from './constants'
import {execute} from './execute'
import {generateWorktree} from './worktree'
import {
Expand All @@ -21,12 +26,19 @@ export async function init(action: ActionInterface): Promise<void | Error> {
action.workspace,
action.silent
)

await execute(
`git config user.email "${action.email}"`,
action.workspace,
action.silent
)

await execute(
`git config core.ignorecase false`,
action.workspace,
action.silent
)

try {
if ((process.env.CI && !action.sshKey) || action.isTest) {
/* Ensures that previously set Git configs do not interfere with the deployment.
Expand Down Expand Up @@ -129,16 +141,22 @@ export async function deploy(action: ActionInterface): Promise<Status> {
} ${
action.clean
? `--delete ${excludes} ${
!fs.existsSync(`${action.folderPath}/CNAME`)
? '--exclude CNAME'
!fs.existsSync(
`${action.folderPath}/${DefaultExcludedFiles.CNAME}`
)
? `--exclude ${DefaultExcludedFiles.CNAME}`
: ''
} ${
!fs.existsSync(`${action.folderPath}/.nojekyll`)
? '--exclude .nojekyll'
!fs.existsSync(
`${action.folderPath}/${DefaultExcludedFiles.NOJEKYLL}`
)
? `--exclude ${DefaultExcludedFiles.NOJEKYLL}`
: ''
}`
: ''
} --exclude .ssh --exclude .git --exclude .github ${
} --exclude ${DefaultExcludedFiles.SSH} --exclude ${
DefaultExcludedFiles.GIT
} --exclude ${DefaultExcludedFiles.GITHUB} ${
action.folderPath === action.workspace
? `--exclude ${temporaryDeploymentDirectory}`
: ''
Expand Down

0 comments on commit a7cf017

Please sign in to comment.