Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit 47be5fd

Browse files
committed
GITHUB - Updated project, complete first version
1 parent 89718dc commit 47be5fd

File tree

6 files changed

+38
-29
lines changed

6 files changed

+38
-29
lines changed

.github/workflows/test-action.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,18 @@ jobs:
1414
- name: test1
1515
id: time1
1616
uses: ./
17-
18-
1917
- name: test1-output
2018
env:
2119
TIME: "${{ steps.time1.outputs.time }}"
2220
run: |
2321
echo $TIME
22+
2423
- name: test2
2524
id: time2
2625
uses: ./
2726
with:
2827
timeZone: 8
2928
format: 'YYYY-MM-DD_HH:mm:ss'
30-
3129
- name: test2-output
3230
env:
3331
TIME: "${{ steps.time2.outputs.time }}"

__tests__/main.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import * as cp from 'child_process'
33
import * as path from 'path'
44
import {expect, test} from '@jest/globals'
55
import {time} from '../src/action/time'
6+
import {labels} from '../src/action/labels'
67

7-
test('wait 500 ms', async () => {
8+
test('check - time action', async () => {
89
await time()
9-
console.log('demo')
10+
})
11+
12+
test('check - time strings', async () => {
13+
await labels()
1014
})
1115

1216
// shows how the runner will run a javascript action with env / stdout protocol

dist/index.js

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

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/action/labels.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,19 @@ const core = __importStar(require("@actions/core"));
3737
function labels() {
3838
return __awaiter(this, void 0, void 0, function* () {
3939
const inputStr = core.getInput('string');
40-
console.log(`Manipulating string: ${inputStr}`);
41-
const lowercase = inputStr.toLowerCase();
42-
console.log(`lowercase: ${lowercase}`);
43-
core.setOutput('lowercase', lowercase);
44-
const uppercase = inputStr.toUpperCase();
45-
console.log(`uppercase: ${uppercase}`);
46-
core.setOutput('uppercase', uppercase);
47-
const capitalized = inputStr.charAt(0).toUpperCase() + inputStr.slice(1).toLowerCase();
48-
console.log(`capitalized: ${capitalized}`);
49-
core.setOutput('capitalized', capitalized);
40+
doLogic(inputStr);
5041
});
5142
}
5243
exports.labels = labels;
44+
function doLogic(inputStr) {
45+
console.log(`Manipulating string: ${inputStr}`);
46+
const lowercase = inputStr.toLowerCase();
47+
console.log(`lowercase: ${lowercase}`);
48+
core.setOutput('lowercase', lowercase);
49+
const uppercase = inputStr.toUpperCase();
50+
console.log(`uppercase: ${uppercase}`);
51+
core.setOutput('uppercase', uppercase);
52+
const capitalized = inputStr.charAt(0).toUpperCase() + inputStr.slice(1).toLowerCase();
53+
console.log(`capitalized: ${capitalized}`);
54+
core.setOutput('capitalized', capitalized);
55+
}

src/action/labels.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ import * as core from '@actions/core'
22

33
export async function labels(): Promise<void> {
44
const inputStr = core.getInput('string')
5-
console.log(`Manipulating string: ${inputStr}`)
5+
doLogic(inputStr)
6+
}
67

8+
function doLogic(inputStr: string): void {
9+
console.log(`Manipulating string: ${inputStr}`)
710
const lowercase = inputStr.toLowerCase()
811
console.log(`lowercase: ${lowercase}`)
912
core.setOutput('lowercase', lowercase)
10-
1113
const uppercase = inputStr.toUpperCase()
1214
console.log(`uppercase: ${uppercase}`)
1315
core.setOutput('uppercase', uppercase)
14-
1516
const capitalized =
1617
inputStr.charAt(0).toUpperCase() + inputStr.slice(1).toLowerCase()
1718
console.log(`capitalized: ${capitalized}`)

0 commit comments

Comments
 (0)