Skip to content

Commit

Permalink
Merge branch 'dev' into releases/v4
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Nov 28, 2024
2 parents 62fec3a + 41a1611 commit 77237a3
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
yarn test
- name: Uploade CodeCov Report
uses: codecov/codecov-action@v4.6.0
uses: codecov/codecov-action@v5.0.7
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ By default, the action does not need any token configuration and uses the provid
| `dry-run` | Do not actually push back, but use `--dry-run` on `git push` invocations instead. | `with` | **No** |
| `single-commit` | This option can be toggled to `true` if you'd prefer to have a single commit on the deployment branch instead of maintaining the full history. **Using this option will also cause any existing history to be wiped from the deployment branch**. | `with` | **No** |
| `force` | Force-push new deployments to overwrite the previous version; otherwise, attempt to rebase new deployments onto any existing ones. This option is turned on by default and can be toggled off by setting it to `false`, which may be useful if there are multiple deployments in a single branch. | `with` | **No** |
| `attempt-limit` | How many rebase attempts to make before suspending the job. This option defaults to `3` and may be useful to increase when there are multiple deployments in a single branch. | `with` | **No** |
| `silent` | Silences the action output preventing it from displaying git messages. | `with` | **No** |
| `tag` | Add a tag to the commit. Only works when `dry-run` is not used. | `with` | **No** |

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@jamesives/github-pages-deploy-action",
"description": "GitHub action for building a project and deploying it to GitHub pages.",
"author": "James Ives <[email protected]> (https://jamesiv.es)",
"version": "4.6.8",
"version": "4.6.9",
"license": "MIT",
"main": "lib/lib.js",
"types": "lib/lib.d.ts",
Expand Down Expand Up @@ -44,10 +44,10 @@
},
"devDependencies": {
"@types/jest": "29.5.14",
"@types/node": "22.9.0",
"@typescript-eslint/eslint-plugin": "8.13.0",
"@typescript-eslint/parser": "8.13.0",
"eslint": "9.14.0",
"@types/node": "22.9.1",
"@typescript-eslint/eslint-plugin": "8.15.0",
"@typescript-eslint/parser": "8.15.0",
"eslint": "9.15.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "28.9.0",
"eslint-plugin-prettier": "5.2.1",
Expand Down
5 changes: 5 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export interface ActionInterface {
folderPath?: string
/** Whether to force-push or attempt to merge existing changes. */
force?: boolean
/** How many times to attempt to merge existing changes into the remote HEAD. */
attemptLimit?: number
/** Determines test scenarios the action is running in. */
isTest: TestFlag
/** The git config name. */
Expand Down Expand Up @@ -95,6 +97,9 @@ export const action: ActionInterface = {
force: !isNullOrUndefined(getInput('force'))
? getInput('force').toLowerCase() === 'true'
: true,
attemptLimit: !isNullOrUndefined(getInput('attempt-limit'))
? parseInt(getInput('attempt-limit'), 10)
: 3,
clean: !isNullOrUndefined(getInput('clean'))
? getInput('clean').toLowerCase() === 'true'
: false,
Expand Down
8 changes: 4 additions & 4 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export async function deploy(action: ActionInterface): Promise<Status> {
Allows the user to specify the root if '.' is provided.
rsync is used to prevent file duplication. */
await execute(
`rsync -q -av --checksum --progress ${action.folderPath}/. ${
`rsync -q -av --checksum --progress --mkpath ${action.folderPath}/. ${
action.targetFolder
? `${temporaryDeploymentDirectory}/${action.targetFolder}`
: temporaryDeploymentDirectory
Expand Down Expand Up @@ -268,7 +268,7 @@ export async function deploy(action: ActionInterface): Promise<Status> {
action.silent
)
} else {
const ATTEMPT_LIMIT = 3
const attemptLimit = action.attemptLimit || 3
// Attempt to push our changes, but fetch + rebase if there were
// other changes added in the meantime
let attempt = 0
Expand All @@ -279,7 +279,7 @@ export async function deploy(action: ActionInterface): Promise<Status> {
do {
attempt++

if (attempt > ATTEMPT_LIMIT) throw new Error(`Attempt limit exceeded`)
if (attempt > attemptLimit) throw new Error(`Attempt limit exceeded`)

// Handle rejection for the previous attempt first such that, on
// the final attempt, time is not wasted rebasing it when it will
Expand All @@ -299,7 +299,7 @@ export async function deploy(action: ActionInterface): Promise<Status> {
)
}

info(`Pushing changes… (attempt ${attempt} of ${ATTEMPT_LIMIT})`)
info(`Pushing changes… (attempt ${attempt} of ${attemptLimit})`)

const pushResult = await execute(
`git push --porcelain ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`,
Expand Down
Loading

0 comments on commit 77237a3

Please sign in to comment.