From 3f829eef9eac641f7d2eef6af693aaeb57dfb58e Mon Sep 17 00:00:00 2001 From: zarko-a <59746384+zarko-a@users.noreply.github.com> Date: Wed, 26 Nov 2025 04:47:19 -0600 Subject: [PATCH] Fix event.json not being copied to /github/workflow in kubernetes-novolume mode (#287) In run-script-step, the _temp directory was being copied to the workflow pod, but the _github_home and _github_workflow directories were not being moved from their temporary location to the /github directory structure where they are expected by GitHub Actions. This caused event.json to be missing at /github/workflow/event.json, breaking actions that depend on GITHUB_EVENT_PATH. The fix adds a setup step that copies _github_home and _github_workflow from /__w/_temp/ to /github/ after copying the temp directory to the pod, matching the behavior of run-container-step and prepareJobScript. Uses cp -r instead of symlinks to avoid symlink validation errors when copying files back from the pod to the runner. --- packages/k8s/src/hooks/run-script-step.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/k8s/src/hooks/run-script-step.ts b/packages/k8s/src/hooks/run-script-step.ts index 0eb7206..60937ec 100644 --- a/packages/k8s/src/hooks/run-script-step.ts +++ b/packages/k8s/src/hooks/run-script-step.ts @@ -6,6 +6,7 @@ import { execCpFromPod, execCpToPod, execPodStep } from '../k8s' import { writeRunScript, sleep, listDirAllCommand } from '../k8s/utils' import { JOB_CONTAINER_NAME } from './constants' import { dirname } from 'path' +import * as shlex from 'shlex' export async function runScriptStep( args: RunScriptStepArgs, @@ -26,6 +27,23 @@ export async function runScriptStep( const runnerTemp = `${workdir}/_temp` await execCpToPod(state.jobPod, runnerTemp, containerTemp) + // Copy GitHub directories from temp to /github + const setupCommands = [ + 'mkdir -p /github', + 'cp -r /__w/_temp/_github_home /github/home', + 'cp -r /__w/_temp/_github_workflow /github/workflow' + ] + + try { + await execPodStep( + ['sh', '-c', shlex.quote(setupCommands.join(' && '))], + state.jobPod, + JOB_CONTAINER_NAME + ) + } catch (err) { + core.debug(`Failed to copy GitHub directories: ${JSON.stringify(err)}`) + } + // Execute the entrypoint script args.entryPoint = 'sh' args.entryPointArgs = ['-e', containerPath]