Skip to content

Commit 77237a3

Browse files
committed
Merge branch 'dev' into releases/v4
2 parents 62fec3a + 41a1611 commit 77237a3

File tree

6 files changed

+114
-113
lines changed

6 files changed

+114
-113
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
yarn test
3333
3434
- name: Uploade CodeCov Report
35-
uses: codecov/codecov-action@v4.6.0
35+
uses: codecov/codecov-action@v5.0.7
3636
with:
3737
token: ${{ secrets.CODECOV_TOKEN }}
3838

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ By default, the action does not need any token configuration and uses the provid
134134
| `dry-run` | Do not actually push back, but use `--dry-run` on `git push` invocations instead. | `with` | **No** |
135135
| `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** |
136136
| `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** |
137+
| `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** |
137138
| `silent` | Silences the action output preventing it from displaying git messages. | `with` | **No** |
138139
| `tag` | Add a tag to the commit. Only works when `dry-run` is not used. | `with` | **No** |
139140

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@jamesives/github-pages-deploy-action",
33
"description": "GitHub action for building a project and deploying it to GitHub pages.",
44
"author": "James Ives <[email protected]> (https://jamesiv.es)",
5-
"version": "4.6.8",
5+
"version": "4.6.9",
66
"license": "MIT",
77
"main": "lib/lib.js",
88
"types": "lib/lib.d.ts",
@@ -44,10 +44,10 @@
4444
},
4545
"devDependencies": {
4646
"@types/jest": "29.5.14",
47-
"@types/node": "22.9.0",
48-
"@typescript-eslint/eslint-plugin": "8.13.0",
49-
"@typescript-eslint/parser": "8.13.0",
50-
"eslint": "9.14.0",
47+
"@types/node": "22.9.1",
48+
"@typescript-eslint/eslint-plugin": "8.15.0",
49+
"@typescript-eslint/parser": "8.15.0",
50+
"eslint": "9.15.0",
5151
"eslint-config-prettier": "9.1.0",
5252
"eslint-plugin-jest": "28.9.0",
5353
"eslint-plugin-prettier": "5.2.1",

src/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export interface ActionInterface {
3838
folderPath?: string
3939
/** Whether to force-push or attempt to merge existing changes. */
4040
force?: boolean
41+
/** How many times to attempt to merge existing changes into the remote HEAD. */
42+
attemptLimit?: number
4143
/** Determines test scenarios the action is running in. */
4244
isTest: TestFlag
4345
/** The git config name. */
@@ -95,6 +97,9 @@ export const action: ActionInterface = {
9597
force: !isNullOrUndefined(getInput('force'))
9698
? getInput('force').toLowerCase() === 'true'
9799
: true,
100+
attemptLimit: !isNullOrUndefined(getInput('attempt-limit'))
101+
? parseInt(getInput('attempt-limit'), 10)
102+
: 3,
98103
clean: !isNullOrUndefined(getInput('clean'))
99104
? getInput('clean').toLowerCase() === 'true'
100105
: false,

src/git.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export async function deploy(action: ActionInterface): Promise<Status> {
166166
Allows the user to specify the root if '.' is provided.
167167
rsync is used to prevent file duplication. */
168168
await execute(
169-
`rsync -q -av --checksum --progress ${action.folderPath}/. ${
169+
`rsync -q -av --checksum --progress --mkpath ${action.folderPath}/. ${
170170
action.targetFolder
171171
? `${temporaryDeploymentDirectory}/${action.targetFolder}`
172172
: temporaryDeploymentDirectory
@@ -268,7 +268,7 @@ export async function deploy(action: ActionInterface): Promise<Status> {
268268
action.silent
269269
)
270270
} else {
271-
const ATTEMPT_LIMIT = 3
271+
const attemptLimit = action.attemptLimit || 3
272272
// Attempt to push our changes, but fetch + rebase if there were
273273
// other changes added in the meantime
274274
let attempt = 0
@@ -279,7 +279,7 @@ export async function deploy(action: ActionInterface): Promise<Status> {
279279
do {
280280
attempt++
281281

282-
if (attempt > ATTEMPT_LIMIT) throw new Error(`Attempt limit exceeded`)
282+
if (attempt > attemptLimit) throw new Error(`Attempt limit exceeded`)
283283

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

302-
info(`Pushing changes… (attempt ${attempt} of ${ATTEMPT_LIMIT})`)
302+
info(`Pushing changes… (attempt ${attempt} of ${attemptLimit})`)
303303

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

0 commit comments

Comments
 (0)