fix state helper
This commit is contained in:
Vendored
+56
-1
@@ -82543,6 +82543,43 @@ function Repo(repo) {
|
||||
exports.Repo = Repo;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8387:
|
||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.SshKnownHostsPath = exports.SshKeyPath = exports.PostSetSafeDirectory = exports.RepositoryPath = exports.IsPost = void 0;
|
||||
const core = __nccwpck_require__(9093);
|
||||
/**
|
||||
* Indicates whether the POST action is running
|
||||
*/
|
||||
exports.IsPost = !!core.getState('isPost');
|
||||
/**
|
||||
* The repository path for the POST action. The value is empty during the MAIN action.
|
||||
*/
|
||||
exports.RepositoryPath = core.getState('repositoryPath');
|
||||
/**
|
||||
* The set-safe-directory for the POST action. The value is set if input: 'safe-directory' is set during the MAIN action.
|
||||
*/
|
||||
exports.PostSetSafeDirectory = core.getState('setSafeDirectory') === 'true';
|
||||
/**
|
||||
* The SSH key path for the POST action. The value is empty during the MAIN action.
|
||||
*/
|
||||
exports.SshKeyPath = core.getState('sshKeyPath');
|
||||
/**
|
||||
* The SSH known hosts path for the POST action. The value is empty during the MAIN action.
|
||||
*/
|
||||
exports.SshKnownHostsPath = core.getState('sshKnownHostsPath');
|
||||
// Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
|
||||
// This is necessary since we don't have a separate entry point.
|
||||
if (!exports.IsPost) {
|
||||
core.saveState('isPost', 'true');
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
@@ -87433,8 +87470,11 @@ const core = __nccwpck_require__(9093);
|
||||
const exec_1 = __nccwpck_require__(7775);
|
||||
const os = __nccwpck_require__(2037);
|
||||
const versions_1 = __nccwpck_require__(406);
|
||||
const stateHelper = __nccwpck_require__(8387);
|
||||
const win_install_1 = __nccwpck_require__(1612);
|
||||
const unix_install_1 = __nccwpck_require__(6689);
|
||||
async function cacheBuild() { }
|
||||
async function cachePackages() { }
|
||||
async function run() {
|
||||
try {
|
||||
const version = await (0, versions_1.selectVersion)();
|
||||
@@ -87452,7 +87492,22 @@ async function run() {
|
||||
core.setFailed(ex.message);
|
||||
}
|
||||
}
|
||||
run().catch((e) => core.error(e));
|
||||
async function cleanup() {
|
||||
try {
|
||||
core.info(`cleanup`);
|
||||
await cacheBuild();
|
||||
}
|
||||
catch (error) {
|
||||
const ex = error;
|
||||
core.setFailed(ex.message);
|
||||
}
|
||||
}
|
||||
if (!stateHelper.IsPost) {
|
||||
run().catch((e) => core.error(e));
|
||||
}
|
||||
else {
|
||||
cleanup().catch((e) => core.error(e));
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
|
||||
+13
-16
@@ -2,15 +2,13 @@ import * as core from '@actions/core';
|
||||
import { exec } from '@actions/exec';
|
||||
import * as os from 'os';
|
||||
import { selectVersion } from './versions';
|
||||
import * as stateHelper from './state-helper'
|
||||
import * as stateHelper from './state-helper';
|
||||
import { winInstall } from './win-install';
|
||||
import { unixInstall } from './unix-install';
|
||||
|
||||
async function cacheBuild(): Promise<void> {
|
||||
}
|
||||
async function cacheBuild(): Promise<void> {}
|
||||
|
||||
async function cachePackages(): Promise<void> {
|
||||
}
|
||||
async function cachePackages(): Promise<void> {}
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
@@ -28,19 +26,18 @@ async function run(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function cleanup(): Promise<void> {
|
||||
try {
|
||||
core.info(`cleanup`);
|
||||
} catch (error) {
|
||||
const ex = error as Error;
|
||||
core.setFailed(ex.message);
|
||||
}
|
||||
try {
|
||||
core.info(`cleanup`);
|
||||
await cacheBuild();
|
||||
} catch (error) {
|
||||
const ex = error as Error;
|
||||
core.setFailed(ex.message);
|
||||
}
|
||||
}
|
||||
|
||||
if (!stateHelper.IsPost) {
|
||||
await run().catch((e: Error) => core.error(e));
|
||||
}
|
||||
else {
|
||||
await cleanup().catch((e: Error) => core.error(e));
|
||||
run().catch((e: Error) => core.error(e));
|
||||
} else {
|
||||
cleanup().catch((e: Error) => core.error(e));
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,32 +1,32 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as core from '@actions/core';
|
||||
|
||||
/**
|
||||
* Indicates whether the POST action is running
|
||||
*/
|
||||
export const IsPost = !!core.getState('isPost')
|
||||
export const IsPost = !!core.getState('isPost');
|
||||
|
||||
/**
|
||||
* The repository path for the POST action. The value is empty during the MAIN action.
|
||||
*/
|
||||
export const RepositoryPath = core.getState('repositoryPath')
|
||||
export const RepositoryPath = core.getState('repositoryPath');
|
||||
|
||||
/**
|
||||
* The set-safe-directory for the POST action. The value is set if input: 'safe-directory' is set during the MAIN action.
|
||||
*/
|
||||
export const PostSetSafeDirectory = core.getState('setSafeDirectory') === 'true'
|
||||
export const PostSetSafeDirectory = core.getState('setSafeDirectory') === 'true';
|
||||
|
||||
/**
|
||||
* The SSH key path for the POST action. The value is empty during the MAIN action.
|
||||
*/
|
||||
export const SshKeyPath = core.getState('sshKeyPath')
|
||||
export const SshKeyPath = core.getState('sshKeyPath');
|
||||
|
||||
/**
|
||||
* The SSH known hosts path for the POST action. The value is empty during the MAIN action.
|
||||
*/
|
||||
export const SshKnownHostsPath = core.getState('sshKnownHostsPath')
|
||||
export const SshKnownHostsPath = core.getState('sshKnownHostsPath');
|
||||
|
||||
// Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
|
||||
// This is necessary since we don't have a separate entry point.
|
||||
if (!IsPost) {
|
||||
core.saveState('isPost', 'true')
|
||||
core.saveState('isPost', 'true');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user