Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add platform info utilities to @actions/core #1551

Merged
merged 5 commits into from
Nov 14, 2023

Conversation

nikolai-laevskii
Copy link
Contributor

Adds shorthands for getting information about platform action is running on:

import { platform } from '@actions/core'

/* same as os.platform() */
platform.platform // 'win32' | 'darwin' | 'linux' | 'freebsd' | 'openbsd' | 'android' | 'cygwin' | 'sunos'

/* same as os.arch() */
platform.arch // 'x64' | 'arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 'riscv64' | 's390' | 's390x'

/* common shorthands for platform-specific logic */
platform.isWindows // true
platform.isMacOS // false
platform.isLinux // false

/* run platform-specific script to get more details about the exact platform, works on Windows, MacOS and Linux */
const {
  name, // Microsoft Windows 11 Enterprise
  version, // 10.0.22621
} = await platform.getDetails()

@nikolai-laevskii nikolai-laevskii requested a review from a team as a code owner October 9, 2023 03:54
@nikolai-laevskii nikolai-laevskii changed the title Add platform info utilities Add platform info utilities to @actions/core Oct 9, 2023
@luketomlinson luketomlinson merged commit 20f826b into actions:main Nov 14, 2023
10 checks passed
joshmgross added a commit that referenced this pull request Oct 2, 2024
@dhensby
Copy link

dhensby commented Oct 8, 2024

I just want to say that I really appreciate this bit of functionality - thanks @nikolai-laevskii - it's allowed me to remove some custom code from my own action 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants