Ignore Case (#987)

* Update git.ts

* Formatting

* formatting

* Tests
This commit is contained in:
James Ives 2022-01-06 14:50:18 +00:00 committed by GitHub
parent 43e20fe3ca
commit a7cf017c75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 15 deletions

View File

@ -12,4 +12,4 @@ updates:
schedule: schedule:
interval: daily interval: daily
time: '10:00' time: '10:00'
open-pull-requests-limit: 10 open-pull-requests-limit: 10

View File

@ -218,7 +218,7 @@ jobs:
integration-container, integration-container,
integration-ssh, integration-ssh,
integration-ssh-third-party-client, integration-ssh-third-party-client,
integration-env integration-env,
] ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View File

@ -75,7 +75,7 @@ on:
- main - 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 📦 #### Install as a Node Module 📦

View File

@ -55,7 +55,7 @@ describe('git', () => {
}) })
await init(action) await init(action)
expect(execute).toBeCalledTimes(5) expect(execute).toBeCalledTimes(6)
}) })
it('should catch when a function throws an error', async () => { it('should catch when a function throws an error', async () => {
@ -102,7 +102,7 @@ describe('git', () => {
}) })
await init(action) await init(action)
expect(execute).toBeCalledTimes(5) expect(execute).toBeCalledTimes(6)
}) })
it('should not unset git config if a user is using ssh', async () => { it('should not unset git config if a user is using ssh', async () => {
@ -124,7 +124,7 @@ describe('git', () => {
}) })
await init(action) await init(action)
expect(execute).toBeCalledTimes(4) expect(execute).toBeCalledTimes(5)
process.env.CI = undefined process.env.CI = undefined
}) })
@ -145,7 +145,7 @@ describe('git', () => {
}) })
await init(action) await init(action)
expect(execute).toBeCalledTimes(5) expect(execute).toBeCalledTimes(6)
}) })
}) })

View File

@ -50,7 +50,7 @@ describe('main', () => {
debug: true debug: true
}) })
await run(action) await run(action)
expect(execute).toBeCalledTimes(15) expect(execute).toBeCalledTimes(16)
expect(rmRF).toBeCalledTimes(1) expect(rmRF).toBeCalledTimes(1)
expect(exportVariable).toBeCalledTimes(1) expect(exportVariable).toBeCalledTimes(1)
}) })
@ -70,7 +70,7 @@ describe('main', () => {
isTest: TestFlag.HAS_CHANGED_FILES isTest: TestFlag.HAS_CHANGED_FILES
}) })
await run(action) await run(action)
expect(execute).toBeCalledTimes(18) expect(execute).toBeCalledTimes(19)
expect(rmRF).toBeCalledTimes(1) expect(rmRF).toBeCalledTimes(1)
expect(exportVariable).toBeCalledTimes(1) expect(exportVariable).toBeCalledTimes(1)
}) })

View File

@ -157,3 +157,12 @@ export enum OperatingSystems {
} }
export const SupportedOperatingSystems = [OperatingSystems.LINUX] export const SupportedOperatingSystems = [OperatingSystems.LINUX]
/* Excluded files. */
export enum DefaultExcludedFiles {
CNAME = 'CNAME',
NOJEKYLL = '.nojekyll',
SSH = '.ssh',
GIT = '.git',
GITHUB = '.github'
}

View File

@ -1,7 +1,12 @@
import {info} from '@actions/core' import {info} from '@actions/core'
import {mkdirP, rmRF} from '@actions/io' import {mkdirP, rmRF} from '@actions/io'
import fs from 'fs' import fs from 'fs'
import {ActionInterface, Status, TestFlag} from './constants' import {
ActionInterface,
DefaultExcludedFiles,
Status,
TestFlag
} from './constants'
import {execute} from './execute' import {execute} from './execute'
import {generateWorktree} from './worktree' import {generateWorktree} from './worktree'
import { import {
@ -21,12 +26,19 @@ export async function init(action: ActionInterface): Promise<void | Error> {
action.workspace, action.workspace,
action.silent action.silent
) )
await execute( await execute(
`git config user.email "${action.email}"`, `git config user.email "${action.email}"`,
action.workspace, action.workspace,
action.silent action.silent
) )
await execute(
`git config core.ignorecase false`,
action.workspace,
action.silent
)
try { try {
if ((process.env.CI && !action.sshKey) || action.isTest) { if ((process.env.CI && !action.sshKey) || action.isTest) {
/* Ensures that previously set Git configs do not interfere with the deployment. /* Ensures that previously set Git configs do not interfere with the deployment.
@ -129,16 +141,22 @@ export async function deploy(action: ActionInterface): Promise<Status> {
} ${ } ${
action.clean action.clean
? `--delete ${excludes} ${ ? `--delete ${excludes} ${
!fs.existsSync(`${action.folderPath}/CNAME`) !fs.existsSync(
? '--exclude CNAME' `${action.folderPath}/${DefaultExcludedFiles.CNAME}`
)
? `--exclude ${DefaultExcludedFiles.CNAME}`
: '' : ''
} ${ } ${
!fs.existsSync(`${action.folderPath}/.nojekyll`) !fs.existsSync(
? '--exclude .nojekyll' `${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 action.folderPath === action.workspace
? `--exclude ${temporaryDeploymentDirectory}` ? `--exclude ${temporaryDeploymentDirectory}`
: '' : ''