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

Commit

Permalink
GITHUB - Updated project, complete first version
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-fgr committed Nov 22, 2022
1 parent 89718dc commit 47be5fd
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 29 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ jobs:
- name: test1
id: time1
uses: ./


- name: test1-output
env:
TIME: "${{ steps.time1.outputs.time }}"
run: |
echo $TIME
- name: test2
id: time2
uses: ./
with:
timeZone: 8
format: 'YYYY-MM-DD_HH:mm:ss'

- name: test2-output
env:
TIME: "${{ steps.time2.outputs.time }}"
Expand Down
8 changes: 6 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import * as cp from 'child_process'
import * as path from 'path'
import {expect, test} from '@jest/globals'
import {time} from '../src/action/time'
import {labels} from '../src/action/labels'

test('wait 500 ms', async () => {
test('check - time action', async () => {
await time()
console.log('demo')
})

test('check - time strings', async () => {
await labels()
})

// shows how the runner will run a javascript action with env / stdout protocol
Expand Down
23 changes: 13 additions & 10 deletions 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 dist/index.js.map

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions lib/action/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ const core = __importStar(require("@actions/core"));
function labels() {
return __awaiter(this, void 0, void 0, function* () {
const inputStr = core.getInput('string');
console.log(`Manipulating string: ${inputStr}`);
const lowercase = inputStr.toLowerCase();
console.log(`lowercase: ${lowercase}`);
core.setOutput('lowercase', lowercase);
const uppercase = inputStr.toUpperCase();
console.log(`uppercase: ${uppercase}`);
core.setOutput('uppercase', uppercase);
const capitalized = inputStr.charAt(0).toUpperCase() + inputStr.slice(1).toLowerCase();
console.log(`capitalized: ${capitalized}`);
core.setOutput('capitalized', capitalized);
doLogic(inputStr);
});
}
exports.labels = labels;
function doLogic(inputStr) {
console.log(`Manipulating string: ${inputStr}`);
const lowercase = inputStr.toLowerCase();
console.log(`lowercase: ${lowercase}`);
core.setOutput('lowercase', lowercase);
const uppercase = inputStr.toUpperCase();
console.log(`uppercase: ${uppercase}`);
core.setOutput('uppercase', uppercase);
const capitalized = inputStr.charAt(0).toUpperCase() + inputStr.slice(1).toLowerCase();
console.log(`capitalized: ${capitalized}`);
core.setOutput('capitalized', capitalized);
}
7 changes: 4 additions & 3 deletions src/action/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import * as core from '@actions/core'

export async function labels(): Promise<void> {
const inputStr = core.getInput('string')
console.log(`Manipulating string: ${inputStr}`)
doLogic(inputStr)
}

function doLogic(inputStr: string): void {
console.log(`Manipulating string: ${inputStr}`)
const lowercase = inputStr.toLowerCase()
console.log(`lowercase: ${lowercase}`)
core.setOutput('lowercase', lowercase)

const uppercase = inputStr.toUpperCase()
console.log(`uppercase: ${uppercase}`)
core.setOutput('uppercase', uppercase)

const capitalized =
inputStr.charAt(0).toUpperCase() + inputStr.slice(1).toLowerCase()
console.log(`capitalized: ${capitalized}`)
Expand Down

0 comments on commit 47be5fd

Please sign in to comment.