fix(docker): mount GitHub environment files directory into containers

- Mount GitHub environment files directory containing GITHUB_ENV, GITHUB_OUTPUT, GITHUB_PATH, and GITHUB_STEP_SUMMARY
- Resolves Docker container exit code -1 when writing to $GITHUB_ENV
- Update volume mapping in both step execution contexts in engine.rs
- Tested on macOS with Docker Desktop

Closes: Issue where echo "VAR=value" >> "$GITHUB_ENV" fails in Docker runtime
This commit is contained in:
bahdotsh
2025-09-05 08:01:29 +05:30
parent 7970e6ad7d
commit f45babc605
4 changed files with 20 additions and 27 deletions

View File

@@ -1,12 +0,0 @@
name: Clippy Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Test secrets after clippy fixes
env:
TEST_VAR: ${{ secrets.TEST_SECRET }}
run: |
echo "Secret length: ${#TEST_VAR}"

View File

@@ -1538,7 +1538,16 @@ async fn execute_step(ctx: StepExecutionContext<'_>) -> Result<StepResult, Execu
let container_workspace = Path::new("/github/workspace");
// Set up volume mapping from host working dir to container workspace
let volumes: Vec<(&Path, &Path)> = vec![(ctx.working_dir, container_workspace)];
let mut volumes: Vec<(&Path, &Path)> = vec![(ctx.working_dir, container_workspace)];
// Also mount the GitHub environment files directory if GITHUB_ENV is set
if let Some(github_env_path) = ctx.job_env.get("GITHUB_ENV") {
if let Some(github_dir) = Path::new(github_env_path).parent() {
if let Some(github_parent) = github_dir.parent() {
volumes.push((github_parent, github_parent));
}
}
}
let output = ctx
.runtime
@@ -1687,7 +1696,16 @@ async fn execute_step(ctx: StepExecutionContext<'_>) -> Result<StepResult, Execu
let container_workspace = Path::new("/github/workspace");
// Set up volume mapping from host working dir to container workspace
let volumes: Vec<(&Path, &Path)> = vec![(ctx.working_dir, container_workspace)];
let mut volumes: Vec<(&Path, &Path)> = vec![(ctx.working_dir, container_workspace)];
// Also mount the GitHub environment files directory if GITHUB_ENV is set
if let Some(github_env_path) = ctx.job_env.get("GITHUB_ENV") {
if let Some(github_dir) = Path::new(github_env_path).parent() {
if let Some(github_parent) = github_dir.parent() {
volumes.push((github_parent, github_parent));
}
}
}
// Execute the command
match ctx

View File

@@ -1,13 +0,0 @@
name: Final Secrets Test
on: [push]
jobs:
verify-secrets:
runs-on: ubuntu-latest
steps:
- name: Test secrets are working
env:
SECRET_VAL: ${{ secrets.TEST_SECRET }}
run: |
echo "Secret length: ${#SECRET_VAL}"
echo "All secrets functionality verified!"