From 66847f00747199080f8d19399debb6e910b1a7b3 Mon Sep 17 00:00:00 2001 From: James Ives Date: Thu, 6 Jan 2022 13:42:46 +0000 Subject: [PATCH] Configures supported operating system check (#981) --- .github/ISSUE_TEMPLATE/BUG_REPORT.md | 5 +++++ src/constants.ts | 9 +++++++++ src/util.ts | 19 +++++++++++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md index 19849a8a..63d48297 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -8,16 +8,21 @@ labels: ## Describe the bug + ## Reproduction Steps + ## Logs + ## Workflow + ## Additional Comments + diff --git a/src/constants.ts b/src/constants.ts index a2f682af..2aacbc1b 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -148,3 +148,12 @@ export enum Status { SKIPPED = 'skipped', RUNNING = 'running' } + +/* Platform codes. */ +export enum OperatingSystems { + LINUX = 'Linux', + WINDOWS = 'Windows', + MACOS = 'macOS' +} + +export const SupportedOperatingSystems = [OperatingSystems.LINUX] diff --git a/src/util.ts b/src/util.ts index 927fea61..ae44704d 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,7 +1,12 @@ -import {isDebug} from '@actions/core' +import {isDebug, info} from '@actions/core' import {existsSync} from 'fs' import path from 'path' -import {ActionInterface, RequiredActionParameters} from './constants' +import { + ActionInterface, + OperatingSystems, + RequiredActionParameters, + SupportedOperatingSystems +} from './constants' /* Replaces all instances of a match in a string. */ const replaceAll = (input: string, find: string, replace: string): string => @@ -66,6 +71,16 @@ export const checkParameters = (action: ActionInterface): void => { `The directory you're trying to deploy named ${action.folderPath} doesn't exist. Please double check the path and any prerequisite build scripts and try again. ❗` ) } + + if ( + SupportedOperatingSystems.includes( + process.env.RUNNER_OS as OperatingSystems + ) + ) { + info( + `The operating system you're using is not supported and results may be varied. Please refer to the documentation for more details. ❗` + ) + } } /* Suppresses sensitive information from being exposed in error messages. */