Skip to content

Commit eec6ac5

Browse files
committed
refactor(create-release): 格式化代码并优化导入顺序和一致性
- 重新排列导入语句顺序,提升代码可读性 - 统一接口、函数及变量声明格式为单行,增强代码统一性 - 规范代码缩进及空行,保持代码风格一致 - 优化错误处理及注释格式,使代码更易维护 - 保持功能逻辑不变,专注代码风格和结构优化
1 parent 56abd6b commit eec6ac5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+5849
-5771
lines changed

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.tmp/

.github/actions/cache-keys/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
name: 'Generate Cache Keys'
2-
description: 'Generate consistent cache keys for Gradle based on gradle files hash'
1+
name: Generate Cache Keys
2+
description: Generate consistent cache keys for Gradle based on gradle files hash
33
outputs:
44
gradle-cache-key:
5-
description: 'Gradle cache key'
5+
description: Gradle cache key
66
value: ${{ steps.generate.outputs.gradle-cache-key }}
77
deps-cache-key:
8-
description: 'Dependencies cache key'
8+
description: Dependencies cache key
99
value: ${{ steps.generate.outputs.deps-cache-key }}
1010
runs:
11-
using: 'composite'
11+
using: composite
1212
steps:
1313
- name: Generate cache keys
1414
id: generate

.github/actions/cache-keys/dist/index.js

Lines changed: 59 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"name": "@github-actions/cache-keys",
3-
"version": "1.0.0",
4-
"private": true,
5-
"type": "module",
6-
"description": "Generate consistent cache keys for Gradle",
7-
"main": "./dist/index.js",
8-
"scripts": {
9-
"build": "cd ../.. && pnpm build",
10-
"typecheck": "tsc --noEmit",
11-
"test": "vitest run",
12-
"test:watch": "vitest"
13-
},
14-
"dependencies": {
15-
"@github-actions/shared": "workspace:*"
16-
}
17-
}
2+
"name": "@github-actions/cache-keys",
3+
"type": "module",
4+
"version": "1.0.0",
5+
"private": true,
6+
"description": "Generate consistent cache keys for Gradle",
7+
"main": "./dist/index.js",
8+
"scripts": {
9+
"build": "cd ../.. && pnpm build",
10+
"typecheck": "tsc --noEmit",
11+
"test": "vitest run",
12+
"test:watch": "vitest"
13+
},
14+
"dependencies": {
15+
"@github-actions/shared": "workspace:*"
16+
}
17+
}

.github/actions/cache-keys/src/index.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,57 @@
88
*/
99

1010
import {
11-
generateCacheKeys,
12-
setOutput,
13-
info,
14-
setFailed,
15-
writeStepSummary,
16-
generateMarkdownTable,
17-
startGroup,
18-
endGroup,
19-
} from '@github-actions/shared';
11+
endGroup,
12+
generateCacheKeys,
13+
generateMarkdownTable,
14+
info,
15+
setFailed,
16+
setOutput,
17+
startGroup,
18+
writeStepSummary,
19+
} from '@github-actions/shared'
2020

2121
/**
2222
* Main entry point for the action
2323
*/
2424
async function run(): Promise<void> {
25-
try {
26-
info('Generating cache keys for Gradle...');
25+
try {
26+
info('Generating cache keys for Gradle...')
2727

28-
startGroup('Cache Key Generation');
28+
startGroup('Cache Key Generation')
2929

30-
// Generate cache keys from workspace root
31-
const cacheKeys = await generateCacheKeys('.');
30+
// Generate cache keys from workspace root
31+
const cacheKeys = await generateCacheKeys('.')
3232

33-
info(`Gradle cache key: ${cacheKeys.gradleCache}`);
34-
info(`Dependencies cache key: ${cacheKeys.depsCache}`);
33+
info(`Gradle cache key: ${cacheKeys.gradleCache}`)
34+
info(`Dependencies cache key: ${cacheKeys.depsCache}`)
3535

36-
endGroup();
36+
endGroup()
3737

38-
// Set outputs
39-
setOutput('gradle-cache-key', cacheKeys.gradleCache);
40-
setOutput('deps-cache-key', cacheKeys.depsCache);
38+
// Set outputs
39+
setOutput('gradle-cache-key', cacheKeys.gradleCache)
40+
setOutput('deps-cache-key', cacheKeys.depsCache)
4141

42-
// Write step summary
43-
const summaryTable = generateMarkdownTable(
44-
['Cache Type', 'Key'],
45-
[
46-
['Gradle Cache', `\`${cacheKeys.gradleCache}\``],
47-
['Dependencies Cache', `\`${cacheKeys.depsCache}\``],
48-
]
49-
);
42+
// Write step summary
43+
const summaryTable = generateMarkdownTable(
44+
['Cache Type', 'Key'],
45+
[
46+
['Gradle Cache', `\`${cacheKeys.gradleCache}\``],
47+
['Dependencies Cache', `\`${cacheKeys.depsCache}\``],
48+
],
49+
)
5050

51-
await writeStepSummary(`## 🔑 Generated Cache Keys\n\n${summaryTable}\n\n### Files Included\n\n- \`gradle/wrapper/gradle-wrapper.properties\`\n- \`gradle/libs.versions.toml\`\n- \`build-logic/**/*.gradle.kts\`\n- \`build-logic/**/*.kt\`\n- \`build.gradle.kts\`\n- \`settings.gradle.kts\`\n- \`gradle.properties\``);
51+
await writeStepSummary(`## 🔑 Generated Cache Keys\n\n${summaryTable}\n\n### Files Included\n\n- \`gradle/wrapper/gradle-wrapper.properties\`\n- \`gradle/libs.versions.toml\`\n- \`build-logic/**/*.gradle.kts\`\n- \`build-logic/**/*.kt\`\n- \`build.gradle.kts\`\n- \`settings.gradle.kts\`\n- \`gradle.properties\``)
5252

53-
info('Cache keys generated successfully!');
54-
} catch (error) {
55-
if (error instanceof Error) {
56-
setFailed(`Action failed: ${error.message}`);
57-
} else {
58-
setFailed('Action failed with unknown error');
59-
}
53+
info('Cache keys generated successfully!')
54+
} catch (error) {
55+
if (error instanceof Error) {
56+
setFailed(`Action failed: ${error.message}`)
57+
} else {
58+
setFailed('Action failed with unknown error')
6059
}
60+
}
6161
}
6262

6363
// Run the action
64-
run();
64+
run()
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"extends": "../../tsconfig.base.json",
3-
"compilerOptions": {
4-
"outDir": "dist",
5-
"rootDir": "src"
6-
},
7-
"include": [
8-
"src/**/*.ts"
9-
],
10-
"exclude": [
11-
"node_modules",
12-
"dist",
13-
"**/*.test.ts"
14-
]
15-
}
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"rootDir": "src",
5+
"outDir": "dist"
6+
},
7+
"include": [
8+
"src/**/*.ts"
9+
],
10+
"exclude": [
11+
"node_modules",
12+
"dist",
13+
"**/*.test.ts"
14+
]
15+
}

.github/actions/create-release/action.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
name: 'Create GitHub Release'
2-
description: 'Create a GitHub Release with generated release notes'
1+
name: Create GitHub Release
2+
description: Create a GitHub Release with generated release notes
33
inputs:
44
version:
55
description: 'Version to release (e.g., 1.0.0 or v1.0.0)'
66
required: true
77
group-id:
8-
description: 'Maven group ID'
8+
description: Maven group ID
99
required: false
10-
default: 'io.github.truenine'
10+
default: io.github.truenine
1111
artifacts:
12-
description: 'Comma-separated list of artifacts'
12+
description: Comma-separated list of artifacts
1313
required: false
1414
default: ''
1515
draft:
16-
description: 'Create as draft release'
16+
description: Create as draft release
1717
required: false
1818
default: false
1919
generate-notes:
20-
description: 'Auto-generate release notes from commits'
20+
description: Auto-generate release notes from commits
2121
required: false
2222
default: true
2323
token:
24-
description: 'GitHub token for API access'
24+
description: GitHub token for API access
2525
required: true
2626
outputs:
2727
release-id:
28-
description: 'ID of the created release'
28+
description: ID of the created release
2929
value: ${{ steps.create.outputs.release-id }}
3030
release-url:
31-
description: 'URL of the created release'
31+
description: URL of the created release
3232
value: ${{ steps.create.outputs.release-url }}
3333
release-created:
34-
description: 'Whether a new release was created'
34+
description: Whether a new release was created
3535
value: ${{ steps.create.outputs.release-created }}
3636
tag-name:
37-
description: 'Tag name of the release'
37+
description: Tag name of the release
3838
value: ${{ steps.create.outputs.tag-name }}
3939
runs:
40-
using: 'composite'
40+
using: composite
4141
steps:
4242
- name: Create Release
4343
id: create

.github/actions/create-release/dist/index.js

Lines changed: 50 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"name": "@github-actions/create-release",
3-
"version": "1.0.0",
4-
"private": true,
5-
"type": "module",
6-
"description": "Create GitHub Release with generated release notes",
7-
"main": "./dist/index.js",
8-
"scripts": {
9-
"build": "cd ../.. && pnpm build",
10-
"typecheck": "tsc --noEmit",
11-
"test": "vitest run",
12-
"test:watch": "vitest"
13-
},
14-
"dependencies": {
15-
"@actions/github": "^6.0.1",
16-
"@github-actions/shared": "workspace:*"
17-
}
18-
}
2+
"name": "@github-actions/create-release",
3+
"type": "module",
4+
"version": "1.0.0",
5+
"private": true,
6+
"description": "Create GitHub Release with generated release notes",
7+
"main": "./dist/index.js",
8+
"scripts": {
9+
"build": "cd ../.. && pnpm build",
10+
"typecheck": "tsc --noEmit",
11+
"test": "vitest run",
12+
"test:watch": "vitest"
13+
},
14+
"dependencies": {
15+
"@actions/github": "^6.0.1",
16+
"@github-actions/shared": "workspace:*"
17+
}
18+
}

0 commit comments

Comments
 (0)