UNPKG

@yuki-no/plugin-sdk

Version:

A GitHub Action that tracks changes between repositories. It creates GitHub issues based on commits from a head repository, making it ideal for documentation translation projects.

30 lines (29 loc) 911 B
import { isNotEmpty } from './common'; export function getInput(name, defaultValue) { return process.env[name] ?? defaultValue; } export const getBooleanInput = (name, defaultValue = false) => { const value = getInput(name); if (value === undefined) { return defaultValue; } return value?.toLowerCase() === 'true'; }; export const getMultilineInput = (name, defaultValue = []) => { const value = getInput(name); if (value === undefined) { return defaultValue; } return splitByNewline(value); }; export const splitByNewline = (text, trim = true) => { const normalizedText = trim ? text?.trim() : text; if (!normalizedText) { return []; } let splittedByNewline = normalizedText.split('\n'); if (trim) { splittedByNewline = splittedByNewline.map(line => line.trim()); } return splittedByNewline.filter(isNotEmpty); };