Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 48 additions & 18 deletions hello-world/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hello-world/dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt",
"test": "jest",
"generate": "yarn build && yarn package",
"all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
},
"dependencies": {
Expand Down
11 changes: 6 additions & 5 deletions hello-world/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import * as core from '@actions/core'
import { getMessage } from './message'
import { run } from './run'

async function run(): Promise<void> {
const main = async (): Promise<void> => {
try {
const name = core.getInput('name', { required: true })
core.info(getMessage(name))
await run({
name: core.getInput('name', { required: true }),
})
} catch (error) {
core.setFailed(error.message)
}
}

run()
main()
1 change: 0 additions & 1 deletion hello-world/src/message.ts

This file was deleted.

9 changes: 9 additions & 0 deletions hello-world/src/run.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as core from '@actions/core'

interface Inputs {
name: string
}

export const run = async (inputs: Inputs): Promise<void> => {
core.info(`my name is ${inputs.name}`)
}
6 changes: 0 additions & 6 deletions hello-world/tests/message.test.ts

This file was deleted.

5 changes: 5 additions & 0 deletions hello-world/tests/run.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { run } from '../src/run'

test('run successfully', async () => {
await expect(run({ name: 'foo' })).resolves.toBeUndefined()
})