Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba88a0e80a | ||
|
|
e5287e06b1 | ||
|
|
7f650514d7 | ||
|
|
cba6741f01 | ||
|
|
30237071ab | ||
|
|
ff395b9380 | ||
|
|
29f94b7cce |
19
.github/stale.yml
vendored
19
.github/stale.yml
vendored
@@ -1,19 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 20
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 5
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
- 'status: pinned'
|
||||
- 'type: security'
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: 'status: stale'
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
9
.github/workflows/stale.yml
vendored
Normal file
9
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
name: 'Handle stale issues and PR'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '00 5,17 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
uses: EndBug/workflows/.github/workflows/stale.yml@main
|
||||
@@ -59,7 +59,10 @@ inputs:
|
||||
tag_push:
|
||||
description: Arguments for the git push --tags command (any additional argument will be added after --tags)
|
||||
required: false
|
||||
|
||||
worktree:
|
||||
description: Arguments for the git worktree commands, see the README for usage
|
||||
required: false
|
||||
|
||||
# Input not required from the user
|
||||
github_token:
|
||||
description: The token used to make requests to the GitHub API. It's NOT used to make commits and should not be changed.
|
||||
|
||||
2
lib/index.js
generated
2
lib/index.js
generated
File diff suppressed because one or more lines are too long
14
package-lock.json
generated
14
package-lock.json
generated
@@ -28,7 +28,7 @@
|
||||
"husky": "^8.0.1",
|
||||
"prettier": "^2.7.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4",
|
||||
"typescript": "^4.8.2",
|
||||
"yamljs": "^0.3.0"
|
||||
}
|
||||
},
|
||||
@@ -3216,9 +3216,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.7.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
|
||||
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
|
||||
"version": "4.8.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz",
|
||||
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
@@ -5831,9 +5831,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.7.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
|
||||
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
|
||||
"version": "4.8.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz",
|
||||
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==",
|
||||
"dev": true
|
||||
},
|
||||
"universal-user-agent": {
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
"husky": "^8.0.1",
|
||||
"prettier": "^2.7.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4",
|
||||
"typescript": "^4.8.2",
|
||||
"yamljs": "^0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
24
src/io.ts
24
src/io.ts
@@ -19,6 +19,7 @@ interface InputTypes {
|
||||
remove: string | undefined
|
||||
tag: string | undefined
|
||||
tag_push: string | undefined
|
||||
worktree: string | undefined
|
||||
|
||||
github_token: string | undefined
|
||||
}
|
||||
@@ -243,6 +244,29 @@ export async function checkInputs() {
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region worktree
|
||||
if (getInput('worktree')) {
|
||||
const parsed = parseInputArray(getInput('worktree') || '')
|
||||
|
||||
if (parsed.length == 1)
|
||||
core.info(
|
||||
"Worktree input parsed as single string, it will be used as if it's the path to the worktree."
|
||||
)
|
||||
else if (parsed.length == 2 || parsed.length == 3)
|
||||
core.info(
|
||||
'Worktree input parsed as [string, string, string], it will be used as follows:\n' +
|
||||
'0: path to the worktree directory\n' +
|
||||
'1: arguments for the git worktree add command (including the directory), defaults to the directory\n' +
|
||||
'2: arguments for the git worktree remove command (including the directory), defaults to the directory'
|
||||
)
|
||||
else
|
||||
core.setFailed(
|
||||
`Worktree input parsed as an array of length ${parsed.length}, correct lenghts are 1, 2, and 3.`
|
||||
)
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region github_token
|
||||
if (!getInput('github_token'))
|
||||
core.warning(
|
||||
|
||||
32
src/main.ts
32
src/main.ts
@@ -14,6 +14,27 @@ core.info(`Running in ${baseDir}`)
|
||||
await checkInputs()
|
||||
|
||||
core.startGroup('Internal logs')
|
||||
|
||||
let worktreeDir: string,
|
||||
worktreeAdd: string,
|
||||
worktreeRemove: string | undefined
|
||||
if (getInput('worktree')) {
|
||||
core.info('> Creating worktree...')
|
||||
;[worktreeDir, worktreeAdd, worktreeRemove] = parseInputArray(
|
||||
getInput('worktree') || ''
|
||||
)
|
||||
worktreeAdd = worktreeAdd || worktreeDir
|
||||
worktreeRemove = worktreeRemove || worktreeDir
|
||||
|
||||
core.debug(`Running: git worktree add ${worktreeAdd}`)
|
||||
await git
|
||||
.raw('worktree', 'add', ...worktreeAdd.split(' '))
|
||||
.then((data) => log(undefined, data))
|
||||
|
||||
core.info('> Changing working directory...')
|
||||
await git.cwd(worktreeDir)
|
||||
} else core.info('> Not creating a worktree.')
|
||||
|
||||
core.info('> Staging files...')
|
||||
|
||||
const ignoreErrors =
|
||||
@@ -198,6 +219,17 @@ core.info(`Running in ${baseDir}`)
|
||||
} else core.info('> No tags to push.')
|
||||
} else core.info('> Not pushing anything.')
|
||||
|
||||
if (worktreeRemove) {
|
||||
core.info('> Switching back to previous working directory...')
|
||||
await git.cwd(baseDir)
|
||||
|
||||
core.info('> Removing worktree...')
|
||||
core.debug(`Running: git worktree remove ${worktreeRemove}`)
|
||||
await git
|
||||
.raw('worktree', 'remove', worktreeRemove.split(' '))
|
||||
.then((data) => log(undefined, data))
|
||||
} else core.info('> No worktree to remove.')
|
||||
|
||||
core.endGroup()
|
||||
core.info('> Task completed.')
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user