Skip to content

Commit

Permalink
perf: use package name and version from package.json instead of hard …
Browse files Browse the repository at this point in the history
…code
  • Loading branch information
kamontat committed Jun 12, 2024
1 parent b3f052b commit 1e5e867
Show file tree
Hide file tree
Showing 4 changed files with 1,519 additions and 1,000 deletions.
16 changes: 8 additions & 8 deletions actions/example-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kcws/actions.example-ts",
"version": "1.0.0",
"name": "@kcactions/example-ts",
"version": "0.1.0",
"main": "lib/index.js",
"author": {
"name": "Kamontat Chantrachirathumrong",
Expand All @@ -18,14 +18,14 @@
"@actions/github": "6.0.0",
"@actions/http-client": "2.2.1",
"@actions/io": "1.1.3",
"@kcws/github-actions": "0.2.2"
"@kcws/github-actions": "0.3.0"
},
"devDependencies": {
"@kcws/eslint-config": "1.12.1",
"@kcws/heft-node-rig": "0.3.0",
"@kcws/prettier-config": "0.9.1",
"@rushstack/heft": "0.66.1",
"@kcws/eslint-config": "1.21.1",
"@kcws/heft-node-rig": "0.17.1",
"@kcws/prettier-config": "0.17.2",
"@rushstack/heft": "0.66.18",
"@types/heft-jest": "1.0.6",
"@types/node": "20.11.30"
"@types/node": "20.14.2"
}
}
4 changes: 1 addition & 3 deletions actions/example-ts/src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import {
ExecContextPlugin,
} from "@kcws/github-actions"

export const context = ContextBuilder.builder()
.setName("example-ts")
.setVersion("v1.0.0")
export const context = ContextBuilder.fromPackageJson()
.addPlugin(new LogContextPlugin())
.addPlugin(new InputContextPlugin())
.addPlugin(new ExecContextPlugin())
Expand Down
5 changes: 4 additions & 1 deletion actions/example-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { AppRunner } from "@kcws/github-actions"
import actions from "./app"

const runner: AppRunner<typeof actions> = (data, context) => {
context.use("log").info("hello {name}", data.input)
const logger = context.use("log")

logger.info("Use {0}: {1}", context.name, context.version)
logger.info("hello {name}", data.input)
}

actions.exec(runner)
Expand Down
Loading

0 comments on commit 1e5e867

Please sign in to comment.