diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 603fef97..8706feda 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,4 +12,4 @@ updates: schedule: interval: daily time: '10:00' - open-pull-requests-limit: 10 \ No newline at end of file + open-pull-requests-limit: 10 diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f818c718..75e5c251 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -218,7 +218,7 @@ jobs: integration-container, integration-ssh, integration-ssh-third-party-client, - integration-env + integration-env, ] runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 81697d63..e37fff6f 100644 --- a/README.md +++ b/README.md @@ -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 📦 diff --git a/__tests__/git.test.ts b/__tests__/git.test.ts index 469556cb..366da22b 100644 --- a/__tests__/git.test.ts +++ b/__tests__/git.test.ts @@ -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 () => { @@ -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 () => { @@ -124,7 +124,7 @@ describe('git', () => { }) await init(action) - expect(execute).toBeCalledTimes(4) + expect(execute).toBeCalledTimes(5) process.env.CI = undefined }) @@ -145,7 +145,7 @@ describe('git', () => { }) await init(action) - expect(execute).toBeCalledTimes(5) + expect(execute).toBeCalledTimes(6) }) }) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index e538decf..7cf28f8f 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -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) }) @@ -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) }) diff --git a/src/constants.ts b/src/constants.ts index 2aacbc1b..02e9e8bb 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -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' +} diff --git a/src/git.ts b/src/git.ts index 291511b2..45ab9821 100644 --- a/src/git.ts +++ b/src/git.ts @@ -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 { @@ -21,12 +26,19 @@ export async function init(action: ActionInterface): Promise { 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. @@ -129,16 +141,22 @@ export async function deploy(action: ActionInterface): Promise { } ${ 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}` : ''