Compare commits

...

7 Commits

Author SHA1 Message Date
Federico Grandi
ba88a0e80a feat: add worktree input 2022-09-02 16:08:26 +00:00
Federico Grandi
e5287e06b1 ci: update stale workflow 2022-08-31 11:57:18 +02:00
Federico Grandi
7f650514d7 ci: fix workflow path 2022-08-29 22:59:48 +00:00
Federico Grandi
cba6741f01 ci: use reusable workflow 2022-08-29 22:58:04 +00:00
Federico Grandi
30237071ab ci: add close issue reason to stale workflow 2022-08-29 19:32:19 +00:00
Federico Grandi
ff395b9380 ci: replace probot with actions workflow
Probot is basically discontinued, even though it's not 100% clear...
2022-08-29 19:24:29 +00:00
dependabot[bot]
29f94b7cce chore(deps-dev): bump typescript from 4.7.4 to 4.8.2 (#427)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.7.4 to 4.8.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.7.4...v4.8.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-29 17:27:24 +02:00
8 changed files with 78 additions and 29 deletions

19
.github/stale.yml vendored
View File

@@ -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
View 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

View File

@@ -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

File diff suppressed because one or more lines are too long

14
package-lock.json generated
View File

@@ -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": {

View File

@@ -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"
}
}

View File

@@ -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(

View File

@@ -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 {