diff --git a/build/index.js b/build/index.js index 174ed43..757a140 100644 --- a/build/index.js +++ b/build/index.js @@ -31679,7 +31679,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = exports.Setup = void 0; +exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = void 0; const core = __importStar(__nccwpck_require__(4181)); const tmp = __importStar(__nccwpck_require__(3728)); const fs = __importStar(__nccwpck_require__(7147)); @@ -31689,26 +31689,6 @@ const typescript_string_operations_1 = __nccwpck_require__(9363); const manager_1 = __nccwpck_require__(1856); const werf = __importStar(__nccwpck_require__(8525)); const minimalWerfVersion = 'v1.1.17'; -function Setup() { - return __awaiter(this, void 0, void 0, function* () { - try { - ProcessGitHubContext(); - const kubeConfigBase64Data = core.getInput('kube-config-base64-data'); - if (kubeConfigBase64Data !== '') { - SetupKubeConfig(kubeConfigBase64Data); - } - const m = new manager_1.Manager(); - yield m.Install(); - process.env.GITHUB_TOKEN = - process.env.GITHUB_TOKEN || core.getInput('github-token'); - yield m.PerformCIEnv(); - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.Setup = Setup; function PrepareEnvironAndRunWerfCommand(args) { return __awaiter(this, void 0, void 0, function* () { try { @@ -31743,6 +31723,10 @@ exports.SetupKubeConfig = SetupKubeConfig; function ProcessGitHubContext() { if (github_1.context.eventName === 'pull_request') { if (github_1.context.payload.pull_request) { + // Do nothing if virtual merge variable is already set + if (process.env.WERF_VIRTUAL_MERGE) { + return; + } const baseSha = github_1.context.payload.pull_request.base.sha; const headSha = github_1.context.payload.pull_request.head.sha; process.env.WERF_VIRTUAL_MERGE = '1'; diff --git a/cleanup/index.js b/cleanup/index.js index c7d7188..53a2fe7 100644 --- a/cleanup/index.js +++ b/cleanup/index.js @@ -31679,7 +31679,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = exports.Setup = void 0; +exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = void 0; const core = __importStar(__nccwpck_require__(4181)); const tmp = __importStar(__nccwpck_require__(3728)); const fs = __importStar(__nccwpck_require__(7147)); @@ -31689,26 +31689,6 @@ const typescript_string_operations_1 = __nccwpck_require__(9363); const manager_1 = __nccwpck_require__(1856); const werf = __importStar(__nccwpck_require__(8525)); const minimalWerfVersion = 'v1.1.17'; -function Setup() { - return __awaiter(this, void 0, void 0, function* () { - try { - ProcessGitHubContext(); - const kubeConfigBase64Data = core.getInput('kube-config-base64-data'); - if (kubeConfigBase64Data !== '') { - SetupKubeConfig(kubeConfigBase64Data); - } - const m = new manager_1.Manager(); - yield m.Install(); - process.env.GITHUB_TOKEN = - process.env.GITHUB_TOKEN || core.getInput('github-token'); - yield m.PerformCIEnv(); - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.Setup = Setup; function PrepareEnvironAndRunWerfCommand(args) { return __awaiter(this, void 0, void 0, function* () { try { @@ -31743,6 +31723,10 @@ exports.SetupKubeConfig = SetupKubeConfig; function ProcessGitHubContext() { if (github_1.context.eventName === 'pull_request') { if (github_1.context.payload.pull_request) { + // Do nothing if virtual merge variable is already set + if (process.env.WERF_VIRTUAL_MERGE) { + return; + } const baseSha = github_1.context.payload.pull_request.base.sha; const headSha = github_1.context.payload.pull_request.head.sha; process.env.WERF_VIRTUAL_MERGE = '1'; diff --git a/converge/index.js b/converge/index.js index 37bb37e..f5e5828 100644 --- a/converge/index.js +++ b/converge/index.js @@ -31628,7 +31628,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = exports.Setup = void 0; +exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = void 0; const core = __importStar(__nccwpck_require__(4181)); const tmp = __importStar(__nccwpck_require__(3728)); const fs = __importStar(__nccwpck_require__(7147)); @@ -31638,26 +31638,6 @@ const typescript_string_operations_1 = __nccwpck_require__(9363); const manager_1 = __nccwpck_require__(1856); const werf = __importStar(__nccwpck_require__(8525)); const minimalWerfVersion = 'v1.1.17'; -function Setup() { - return __awaiter(this, void 0, void 0, function* () { - try { - ProcessGitHubContext(); - const kubeConfigBase64Data = core.getInput('kube-config-base64-data'); - if (kubeConfigBase64Data !== '') { - SetupKubeConfig(kubeConfigBase64Data); - } - const m = new manager_1.Manager(); - yield m.Install(); - process.env.GITHUB_TOKEN = - process.env.GITHUB_TOKEN || core.getInput('github-token'); - yield m.PerformCIEnv(); - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.Setup = Setup; function PrepareEnvironAndRunWerfCommand(args) { return __awaiter(this, void 0, void 0, function* () { try { @@ -31692,6 +31672,10 @@ exports.SetupKubeConfig = SetupKubeConfig; function ProcessGitHubContext() { if (github_1.context.eventName === 'pull_request') { if (github_1.context.payload.pull_request) { + // Do nothing if virtual merge variable is already set + if (process.env.WERF_VIRTUAL_MERGE) { + return; + } const baseSha = github_1.context.payload.pull_request.base.sha; const headSha = github_1.context.payload.pull_request.head.sha; process.env.WERF_VIRTUAL_MERGE = '1'; diff --git a/dismiss/index.js b/dismiss/index.js index 49561f9..486d0e3 100644 --- a/dismiss/index.js +++ b/dismiss/index.js @@ -31628,7 +31628,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = exports.Setup = void 0; +exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = void 0; const core = __importStar(__nccwpck_require__(4181)); const tmp = __importStar(__nccwpck_require__(3728)); const fs = __importStar(__nccwpck_require__(7147)); @@ -31638,26 +31638,6 @@ const typescript_string_operations_1 = __nccwpck_require__(9363); const manager_1 = __nccwpck_require__(1856); const werf = __importStar(__nccwpck_require__(8525)); const minimalWerfVersion = 'v1.1.17'; -function Setup() { - return __awaiter(this, void 0, void 0, function* () { - try { - ProcessGitHubContext(); - const kubeConfigBase64Data = core.getInput('kube-config-base64-data'); - if (kubeConfigBase64Data !== '') { - SetupKubeConfig(kubeConfigBase64Data); - } - const m = new manager_1.Manager(); - yield m.Install(); - process.env.GITHUB_TOKEN = - process.env.GITHUB_TOKEN || core.getInput('github-token'); - yield m.PerformCIEnv(); - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.Setup = Setup; function PrepareEnvironAndRunWerfCommand(args) { return __awaiter(this, void 0, void 0, function* () { try { @@ -31692,6 +31672,10 @@ exports.SetupKubeConfig = SetupKubeConfig; function ProcessGitHubContext() { if (github_1.context.eventName === 'pull_request') { if (github_1.context.payload.pull_request) { + // Do nothing if virtual merge variable is already set + if (process.env.WERF_VIRTUAL_MERGE) { + return; + } const baseSha = github_1.context.payload.pull_request.base.sha; const headSha = github_1.context.payload.pull_request.head.sha; process.env.WERF_VIRTUAL_MERGE = '1'; diff --git a/install/index.js b/install/index.js index b2aecb7..05d6e9d 100644 --- a/install/index.js +++ b/install/index.js @@ -31672,6 +31672,10 @@ exports.SetupKubeConfig = SetupKubeConfig; function ProcessGitHubContext() { if (github_1.context.eventName === 'pull_request') { if (github_1.context.payload.pull_request) { + // Do nothing if virtual merge variable is already set + if (process.env.WERF_VIRTUAL_MERGE) { + return; + } const baseSha = github_1.context.payload.pull_request.base.sha; const headSha = github_1.context.payload.pull_request.head.sha; process.env.WERF_VIRTUAL_MERGE = '1'; diff --git a/run/index.js b/run/index.js index 2dad47b..a3f8208 100644 --- a/run/index.js +++ b/run/index.js @@ -31680,7 +31680,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = exports.Setup = void 0; +exports.ValidateWerfVersion = exports.ProcessGitHubContext = exports.SetupKubeConfig = exports.PrepareEnvironAndRunWerfCommand = void 0; const core = __importStar(__nccwpck_require__(4181)); const tmp = __importStar(__nccwpck_require__(3728)); const fs = __importStar(__nccwpck_require__(7147)); @@ -31690,26 +31690,6 @@ const typescript_string_operations_1 = __nccwpck_require__(9363); const manager_1 = __nccwpck_require__(1856); const werf = __importStar(__nccwpck_require__(8525)); const minimalWerfVersion = 'v1.1.17'; -function Setup() { - return __awaiter(this, void 0, void 0, function* () { - try { - ProcessGitHubContext(); - const kubeConfigBase64Data = core.getInput('kube-config-base64-data'); - if (kubeConfigBase64Data !== '') { - SetupKubeConfig(kubeConfigBase64Data); - } - const m = new manager_1.Manager(); - yield m.Install(); - process.env.GITHUB_TOKEN = - process.env.GITHUB_TOKEN || core.getInput('github-token'); - yield m.PerformCIEnv(); - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.Setup = Setup; function PrepareEnvironAndRunWerfCommand(args) { return __awaiter(this, void 0, void 0, function* () { try { @@ -31744,6 +31724,10 @@ exports.SetupKubeConfig = SetupKubeConfig; function ProcessGitHubContext() { if (github_1.context.eventName === 'pull_request') { if (github_1.context.payload.pull_request) { + // Do nothing if virtual merge variable is already set + if (process.env.WERF_VIRTUAL_MERGE) { + return; + } const baseSha = github_1.context.payload.pull_request.base.sha; const headSha = github_1.context.payload.pull_request.head.sha; process.env.WERF_VIRTUAL_MERGE = '1'; diff --git a/src/common.ts b/src/common.ts index 2ce3b08..149618e 100644 --- a/src/common.ts +++ b/src/common.ts @@ -47,13 +47,17 @@ export async function SetupKubeConfig( export function ProcessGitHubContext(): void { if (context.eventName === 'pull_request') { if (context.payload.pull_request) { + // Do nothing if virtual merge variable is already set + if (process.env.WERF_VIRTUAL_MERGE) { + return + } + const baseSha = context.payload.pull_request.base.sha const headSha = context.payload.pull_request.head.sha process.env.WERF_VIRTUAL_MERGE = '1' process.env.WERF_VIRTUAL_MERGE_FROM_COMMIT = headSha process.env.WERF_VIRTUAL_MERGE_INTO_COMMIT = baseSha - core.exportVariable('WERF_VIRTUAL_MERGE', '1') core.exportVariable('WERF_VIRTUAL_MERGE_FROM_COMMIT', headSha) core.exportVariable('WERF_VIRTUAL_MERGE_INTO_COMMIT', baseSha) diff --git a/src/install.ts b/src/install.ts index aecc3bb..4165b10 100644 --- a/src/install.ts +++ b/src/install.ts @@ -5,7 +5,7 @@ import {ProcessGitHubContext} from './common' async function run(): Promise { try { ProcessGitHubContext() - + const m = new Manager() await m.Install() } catch (error) {