mirror of
https://github.com/threeal/cmake-action.git
synced 2026-02-01 19:40:49 +00:00
chore: bump gha-utils from 0.2.0 to 0.3.0 (#446)
Bumps [gha-utils](https://github.com/threeal/gha-utils) from 0.2.0 to 0.3.0. - [Release notes](https://github.com/threeal/gha-utils/releases) - [Commits](https://github.com/threeal/gha-utils/compare/v0.2.0...v0.3.0) --- updated-dependencies: - dependency-name: gha-utils dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alfi Maulana <alfi.maulana.f@gmail.com>
This commit is contained in:
28
dist/action.mjs
generated
vendored
28
dist/action.mjs
generated
vendored
@@ -1,8 +1,23 @@
|
||||
import fs from 'node:fs';
|
||||
import 'node:fs';
|
||||
import fsPromises from 'node:fs/promises';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
|
||||
/**
|
||||
* Retrieves the value of an environment variable.
|
||||
*
|
||||
* @param name - The name of the environment variable.
|
||||
* @returns The value of the environment variable.
|
||||
* @throws Error if the environment variable is not defined.
|
||||
*/
|
||||
function mustGetEnvironment(name) {
|
||||
const value = process.env[name];
|
||||
if (value === undefined) {
|
||||
throw new Error(`the ${name} environment variable must be defined`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Retrieves the value of a GitHub Actions input.
|
||||
*
|
||||
@@ -17,11 +32,14 @@ function getInput(name) {
|
||||
* Sets the value of a GitHub Actions output.
|
||||
*
|
||||
* @param name - The name of the GitHub Actions output.
|
||||
* @param value - The value of the GitHub Actions output
|
||||
* @param value - The value to set for the GitHub Actions output.
|
||||
* @returns A promise that resolves when the value is successfully set.
|
||||
*/
|
||||
function setOutput(name, value) {
|
||||
fs.appendFileSync(process.env["GITHUB_OUTPUT"], `${name}=${value}${os.EOL}`);
|
||||
async function setOutput(name, value) {
|
||||
const filePath = mustGetEnvironment("GITHUB_OUTPUT");
|
||||
await fsPromises.appendFile(filePath, `${name}=${value}${os.EOL}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an error message in GitHub Actions.
|
||||
*
|
||||
@@ -109,7 +127,7 @@ function getContext() {
|
||||
try {
|
||||
const context = getContext();
|
||||
configureProject(context);
|
||||
setOutput("build-dir", context.buildDir);
|
||||
await setOutput("build-dir", context.buildDir);
|
||||
if (context.build.enabled) {
|
||||
buildProject(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user