Configures supported operating system check (#981)

This commit is contained in:
James Ives 2022-01-06 13:42:46 +00:00 committed by GitHub
parent a5d8ac6765
commit 66847f0074
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 2 deletions

View File

@ -8,16 +8,21 @@ labels:
<!-- Please check the Q&A before posting an issue: https://github.com/JamesIves/github-pages-deploy-action/discussions?discussions_q=category%3AQ%26A --> <!-- Please check the Q&A before posting an issue: https://github.com/JamesIves/github-pages-deploy-action/discussions?discussions_q=category%3AQ%26A -->
## Describe the bug ## Describe the bug
<!-- Please provide a clear and concise description of what the bug is. --> <!-- Please provide a clear and concise description of what the bug is. -->
## Reproduction Steps ## Reproduction Steps
<!-- Steps to reproduce the behavior. --> <!-- Steps to reproduce the behavior. -->
## Logs ## Logs
<!-- Please provide your deployment logs. If the error message isn't revealing the problem please set ACTIONS_STEP_DEBUG to true in your repository's secrets menu and run the workflow again. --> <!-- Please provide your deployment logs. If the error message isn't revealing the problem please set ACTIONS_STEP_DEBUG to true in your repository's secrets menu and run the workflow again. -->
## Workflow ## Workflow
<!-- Please provide a link or snippet of your workflow yml file. --> <!-- Please provide a link or snippet of your workflow yml file. -->
## Additional Comments ## Additional Comments
<!--Add any other context about the problem here. --> <!--Add any other context about the problem here. -->

View File

@ -148,3 +148,12 @@ export enum Status {
SKIPPED = 'skipped', SKIPPED = 'skipped',
RUNNING = 'running' RUNNING = 'running'
} }
/* Platform codes. */
export enum OperatingSystems {
LINUX = 'Linux',
WINDOWS = 'Windows',
MACOS = 'macOS'
}
export const SupportedOperatingSystems = [OperatingSystems.LINUX]

View File

@ -1,7 +1,12 @@
import {isDebug} from '@actions/core' import {isDebug, info} from '@actions/core'
import {existsSync} from 'fs' import {existsSync} from 'fs'
import path from 'path' 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. */ /* Replaces all instances of a match in a string. */
const replaceAll = (input: string, find: string, replace: string): 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. ❗` `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. */ /* Suppresses sensitive information from being exposed in error messages. */