change-string-case/index.js

22 lines
688 B
JavaScript
Raw Normal View History

2020-07-30 00:10:10 +08:00
const core = require('@actions/core');
const github = require('@actions/github');
try {
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);
console.log(`capitalized: ${capitalized}`);
core.setOutput("capitalized", capitalized);
} catch (error) {
core.setFailed(error.message);
}