Skip to content

Commit 65d0fc5

Browse files
committed
My first action is ready
0 parents  commit 65d0fc5

File tree

5 files changed

+325
-0
lines changed

5 files changed

+325
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Hello world javascript action
2+
3+
This action prints "Hello World" or "Hello" + the name of a person to greet to the log.
4+
5+
## Inputs
6+
7+
### `who-to-greet`
8+
9+
**Required** The name of the person to greet. Default `"World"`.
10+
11+
## Outputs
12+
13+
### `time`
14+
15+
The time we greeted you.
16+
17+
## Example usage
18+
19+
```yaml
20+
uses: actions/hello-world-javascript-action@e76147da8e5c81eaf017dede5645551d4b94427b
21+
with:
22+
who-to-greet: 'Mona the Octocat'
23+
```

action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: 'Hello World'
2+
description: 'Greet someone and record the time'
3+
inputs:
4+
who-to-greet: # id of input
5+
description: 'Who to greet'
6+
required: true
7+
default: 'World'
8+
outputs:
9+
time: # id of output
10+
description: 'The time we greeted you'
11+
runs:
12+
using: 'node20'
13+
main: 'index.js'

index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const core = require('@actions/core');
2+
const github = require('@actions/github');
3+
4+
try {
5+
// `who-to-greet` input defined in action metadata file
6+
const nameToGreet = core.getInput('who-to-greet');
7+
console.log(`Hello ${nameToGreet}!`);
8+
const time = (new Date()).toTimeString();
9+
core.setOutput("time", time);
10+
// Get the JSON webhook payload for the event that triggered the workflow
11+
const payload = JSON.stringify(github.context.payload, undefined, 2)
12+
console.log(`The event payload: ${payload}`);
13+
} catch (error) {
14+
core.setFailed(error.message);
15+
}

package-lock.json

Lines changed: 258 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "setup-static-php",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"@actions/core": "^1.11.1",
14+
"@actions/github": "^6.0.0"
15+
}
16+
}

0 commit comments

Comments
 (0)