Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions staged/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1742,14 +1742,19 @@ async fn run_prerun_actions(
.list_project_actions_by_type(&branch.project_id, crate::store::ActionType::Prerun)
.map_err(|e| e.to_string())?;

// Use the effective working directory (worktree + project subpath)
// so actions run from the directory where build files (justfile, etc.) live
let working_dir = get_branch_working_dir(&store, &branch)?;
let working_dir_str = working_dir.to_string_lossy().to_string();

// Execute each prerun action in order
for action in prerun_actions {
if let Err(e) = runner.run_action(
app.clone(),
store.clone(),
branch.id.clone(),
action.id.clone(),
branch.worktree_path.clone(),
working_dir_str.clone(),
) {
eprintln!("Failed to run prerun action '{}': {}", action.name, e);
// Continue with other actions even if one fails
Expand Down Expand Up @@ -3064,14 +3069,18 @@ fn run_branch_action(
.map_err(|e| e.to_string())?
.ok_or_else(|| format!("Branch not found: {}", branch_id))?;

// Use the effective working directory (worktree + project subpath)
// so actions run from the directory where build files (justfile, etc.) live
let working_dir = get_branch_working_dir(&state, &branch)?;

// Run the action
runner
.run_action(
app,
state.inner().clone(),
branch_id,
action_id,
branch.worktree_path,
working_dir.to_string_lossy().to_string(),
)
.map_err(|e| e.to_string())
}
Expand Down