mirror of https://github.com/actions/checkout
Compare commits
5 Commits
d8d83b79da
...
8f58476e33
| Author | SHA1 | Date |
|---|---|---|
|
|
8f58476e33 | |
|
|
e8d4307400 | |
|
|
631c942040 | |
|
|
55ad59dfaa | |
|
|
dedef103f1 |
|
|
@ -1,3 +0,0 @@
|
||||||
dist/
|
|
||||||
lib/
|
|
||||||
node_modules/
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
{
|
|
||||||
"plugins": ["jest", "@typescript-eslint"],
|
|
||||||
"extends": ["plugin:github/recommended"],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 9,
|
|
||||||
"sourceType": "module",
|
|
||||||
"project": "./tsconfig.json"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"eslint-comments/no-use": "off",
|
|
||||||
"import/no-namespace": "off",
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": "error",
|
|
||||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
|
||||||
"@typescript-eslint/no-require-imports": "error",
|
|
||||||
"@typescript-eslint/array-type": "error",
|
|
||||||
"@typescript-eslint/await-thenable": "error",
|
|
||||||
"camelcase": "off",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
|
||||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
|
||||||
"@typescript-eslint/no-array-constructor": "error",
|
|
||||||
"@typescript-eslint/no-empty-interface": "error",
|
|
||||||
"@typescript-eslint/no-explicit-any": "error",
|
|
||||||
"@typescript-eslint/no-extraneous-class": "error",
|
|
||||||
"@typescript-eslint/no-floating-promises": "error",
|
|
||||||
"@typescript-eslint/no-for-in-array": "error",
|
|
||||||
"@typescript-eslint/no-inferrable-types": "error",
|
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
|
||||||
"@typescript-eslint/no-namespace": "error",
|
|
||||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
||||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
||||||
"@typescript-eslint/no-useless-constructor": "error",
|
|
||||||
"@typescript-eslint/no-var-requires": "error",
|
|
||||||
"@typescript-eslint/prefer-for-of": "warn",
|
|
||||||
"@typescript-eslint/prefer-function-type": "warn",
|
|
||||||
"@typescript-eslint/prefer-includes": "error",
|
|
||||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
||||||
"@typescript-eslint/promise-function-async": "error",
|
|
||||||
"@typescript-eslint/require-array-sort-compare": "error",
|
|
||||||
"@typescript-eslint/restrict-plus-operands": "error",
|
|
||||||
"semi": "off",
|
|
||||||
"@typescript-eslint/semi": ["error", "never"],
|
|
||||||
"@typescript-eslint/type-annotation-spacing": "error",
|
|
||||||
"@typescript-eslint/unbound-method": "error"
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest/globals": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -31,7 +31,7 @@ jobs:
|
||||||
# Use `docker/login-action` to log in to GHCR.io.
|
# Use `docker/login-action` to log in to GHCR.io.
|
||||||
# Once published, the packages are scoped to the account defined here.
|
# Once published, the packages are scoped to the account defined here.
|
||||||
- name: Log in to the ghcr.io container registry
|
- name: Log in to the ghcr.io container registry
|
||||||
uses: docker/login-action@v4.2.0
|
uses: docker/login-action@v4.4.0
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
|
|
@ -48,7 +48,7 @@ jobs:
|
||||||
|
|
||||||
# Use `docker/build-push-action` to build (and optionally publish) the image.
|
# Use `docker/build-push-action` to build (and optionally publish) the image.
|
||||||
- name: Build Docker Image (with optional Push)
|
- name: Build Docker Image (with optional Push)
|
||||||
uses: docker/build-push-action@v7.2.0
|
uses: docker/build-push-action@v7.3.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: images/test-ubuntu-git.Dockerfile
|
file: images/test-ubuntu-git.Dockerfile
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
import github from 'eslint-plugin-github'
|
||||||
|
import jest from 'eslint-plugin-jest'
|
||||||
|
|
||||||
|
const githubConfigs = github.getFlatConfigs()
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
ignores: ['**/node_modules/**', '**/lib/**', '**/dist/**']
|
||||||
|
},
|
||||||
|
githubConfigs.recommended,
|
||||||
|
...githubConfigs.typescript,
|
||||||
|
{
|
||||||
|
files: ['**/*.ts'],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: './tsconfig.json'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'eslint-comments/no-use': 'off',
|
||||||
|
'import/no-namespace': 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'error',
|
||||||
|
'@typescript-eslint/explicit-member-accessibility': [
|
||||||
|
'error',
|
||||||
|
{accessibility: 'no-public'}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-require-imports': 'error',
|
||||||
|
'@typescript-eslint/array-type': 'error',
|
||||||
|
'@typescript-eslint/await-thenable': 'error',
|
||||||
|
camelcase: 'off',
|
||||||
|
'@typescript-eslint/explicit-function-return-type': [
|
||||||
|
'error',
|
||||||
|
{allowExpressions: true}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-array-constructor': 'error',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'error',
|
||||||
|
'@typescript-eslint/no-extraneous-class': 'error',
|
||||||
|
'@typescript-eslint/no-floating-promises': 'error',
|
||||||
|
'@typescript-eslint/no-for-in-array': 'error',
|
||||||
|
'@typescript-eslint/no-inferrable-types': 'error',
|
||||||
|
'@typescript-eslint/no-misused-new': 'error',
|
||||||
|
'@typescript-eslint/no-namespace': 'error',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||||
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
||||||
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||||
|
'@typescript-eslint/no-useless-constructor': 'error',
|
||||||
|
'@typescript-eslint/prefer-for-of': 'warn',
|
||||||
|
'@typescript-eslint/prefer-function-type': 'warn',
|
||||||
|
'@typescript-eslint/prefer-includes': 'error',
|
||||||
|
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
||||||
|
'@typescript-eslint/promise-function-async': 'error',
|
||||||
|
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||||
|
'@typescript-eslint/restrict-plus-operands': 'error',
|
||||||
|
'@typescript-eslint/unbound-method': 'error'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['__test__/**/*.ts'],
|
||||||
|
...jest.configs['flat/recommended']
|
||||||
|
}
|
||||||
|
]
|
||||||
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
|
|
@ -41,12 +41,12 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.12",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/node": "^24.1.0",
|
"@types/node": "^24.1.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
||||||
"@typescript-eslint/parser": "^7.9.0",
|
"@typescript-eslint/parser": "^8.54.0",
|
||||||
"@vercel/ncc": "^0.44.0",
|
"@vercel/ncc": "^0.44.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^9.39.2",
|
||||||
"eslint-plugin-github": "^4.10.2",
|
"eslint-plugin-github": "^6.0.0",
|
||||||
"eslint-plugin-jest": "^28.8.2",
|
"eslint-plugin-jest": "^29.12.1",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"js-yaml": "^4.2.0",
|
"js-yaml": "^4.2.0",
|
||||||
"prettier": "^3.8.4",
|
"prettier": "^3.8.4",
|
||||||
|
|
|
||||||
|
|
@ -336,7 +336,7 @@ class GitCommandManager {
|
||||||
line = line.trim()
|
line = line.trim()
|
||||||
if (line.startsWith('ref:') || line.endsWith('HEAD')) {
|
if (line.startsWith('ref:') || line.endsWith('HEAD')) {
|
||||||
return line
|
return line
|
||||||
.substr('ref:'.length, line.length - 'ref:'.length - 'HEAD'.length)
|
.slice('ref:'.length, line.length - 'HEAD'.length)
|
||||||
.trim()
|
.trim()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,11 @@ export async function prepareExistingDirectory(
|
||||||
if (ref) {
|
if (ref) {
|
||||||
ref = ref.startsWith('refs/') ? ref : `refs/heads/${ref}`
|
ref = ref.startsWith('refs/') ? ref : `refs/heads/${ref}`
|
||||||
if (ref.startsWith('refs/heads/')) {
|
if (ref.startsWith('refs/heads/')) {
|
||||||
const upperName1 = ref.toUpperCase().substr('REFS/HEADS/'.length)
|
const upperName1 = ref.toUpperCase().slice('REFS/HEADS/'.length)
|
||||||
const upperName1Slash = `${upperName1}/`
|
const upperName1Slash = `${upperName1}/`
|
||||||
branches = await git.branchList(true)
|
branches = await git.branchList(true)
|
||||||
for (const branch of branches) {
|
for (const branch of branches) {
|
||||||
const upperName2 = branch.substr('origin/'.length).toUpperCase()
|
const upperName2 = branch.slice('origin/'.length).toUpperCase()
|
||||||
const upperName2Slash = `${upperName2}/`
|
const upperName2Slash = `${upperName2}/`
|
||||||
if (
|
if (
|
||||||
upperName1.startsWith(upperName2Slash) ||
|
upperName1.startsWith(upperName2Slash) ||
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ function updateUsage(
|
||||||
const newReadme: string[] = []
|
const newReadme: string[] = []
|
||||||
|
|
||||||
// Append the beginning
|
// Append the beginning
|
||||||
newReadme.push(originalReadme.substr(0, startTokenIndex + startToken.length))
|
newReadme.push(originalReadme.slice(0, startTokenIndex + startToken.length))
|
||||||
|
|
||||||
// Build the new usage section
|
// Build the new usage section
|
||||||
newReadme.push('```yaml', `- uses: ${actionReference}`, ' with:')
|
newReadme.push('```yaml', `- uses: ${actionReference}`, ' with:')
|
||||||
|
|
@ -71,9 +71,9 @@ function updateUsage(
|
||||||
// Longer than width? Find a space to break apart
|
// Longer than width? Find a space to break apart
|
||||||
let segment: string = description
|
let segment: string = description
|
||||||
if (description.length > width) {
|
if (description.length > width) {
|
||||||
segment = description.substr(0, width + 1)
|
segment = description.slice(0, width + 1)
|
||||||
while (!segment.endsWith(' ') && !segment.endsWith('\n') && segment) {
|
while (!segment.endsWith(' ') && !segment.endsWith('\n') && segment) {
|
||||||
segment = segment.substr(0, segment.length - 1)
|
segment = segment.slice(0, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trimmed too much?
|
// Trimmed too much?
|
||||||
|
|
@ -87,14 +87,14 @@ function updateUsage(
|
||||||
// Check for newline
|
// Check for newline
|
||||||
const newlineIndex = segment.indexOf('\n')
|
const newlineIndex = segment.indexOf('\n')
|
||||||
if (newlineIndex >= 0) {
|
if (newlineIndex >= 0) {
|
||||||
segment = segment.substr(0, newlineIndex + 1)
|
segment = segment.slice(0, newlineIndex + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append segment
|
// Append segment
|
||||||
newReadme.push(` # ${segment}`.trimRight())
|
newReadme.push(` # ${segment}`.trimRight())
|
||||||
|
|
||||||
// Remaining
|
// Remaining
|
||||||
description = description.substr(segment.length)
|
description = description.slice(segment.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.default !== undefined) {
|
if (input.default !== undefined) {
|
||||||
|
|
@ -116,7 +116,7 @@ function updateUsage(
|
||||||
newReadme.push('```')
|
newReadme.push('```')
|
||||||
|
|
||||||
// Append the end
|
// Append the end
|
||||||
newReadme.push(originalReadme.substr(endTokenIndex))
|
newReadme.push(originalReadme.slice(endTokenIndex))
|
||||||
|
|
||||||
// Write the new README
|
// Write the new README
|
||||||
fs.writeFileSync(readmePath, newReadme.join(os.EOL))
|
fs.writeFileSync(readmePath, newReadme.join(os.EOL))
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,6 @@ function select(obj: any, path: string): any {
|
||||||
return obj[path]
|
return obj[path]
|
||||||
}
|
}
|
||||||
|
|
||||||
const key = path.substr(0, i)
|
const key = path.slice(0, i)
|
||||||
return select(obj[key], path.substr(i + 1))
|
return select(obj[key], path.slice(i + 1))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue