Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Fix CI: PTY echo timing normalization and workflow permissions (#456)

Maximilian Roosd2051f3ef910
diff --git a/.github/workflows/claude-ci-fix.yaml b/.github/workflows/claude-ci-fix.yaml
index 9709f27d3..b6f2da3ef 100644
--- a/.github/workflows/claude-ci-fix.yaml
+++ b/.github/workflows/claude-ci-fix.yaml
@@ -23,6 +23,7 @@ jobs:
contents: write
pull-requests: write
actions: read
+ id-token: write
steps:
- name: 📂 Checkout code
uses: actions/checkout@v6
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index c825485a1..52c593d19 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -983,6 +983,17 @@ mod pty_tests {
.unwrap()
.replace_all(&output, "");
+ // Remove echoed user input at end of prompt line (PTY echo timing varies).
+ // The prompt ends with [y/N/?][22m and then the echoed input appears.
+ // Normalize to just the prompt without echoed input.
+ let output = regex::Regex::new(r"(\[y/N/\?\]\x1b\[22m) [yn]")
+ .unwrap()
+ .replace_all(&output, "$1 ");
+
+ // Remove standalone echoed input lines (just y or n on their own line)
+ // that appear due to PTY timing differences
+ let output = regex::Regex::new(r"^[yn]\n").unwrap().replace(&output, "");
+
// Replace temp home path with ~/
let home_path = temp_home.path().to_string_lossy();
output.replace(&*home_path, "~").to_string()
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap
index 7edea3f09..eb6db1bb6 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap
@@ -2,7 +2,6 @@
source: tests/integration_tests/configure_shell.rs
expression: normalized
---
-n
❯ Install shell integration? [y/N/?]
✗ Cancelled by user
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
index 9690a2655..95a228bde 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
@@ -2,7 +2,6 @@
source: tests/integration_tests/configure_shell.rs
expression: normalized
---
-y
❯ Install shell integration? [y/N/?]
✓ Added shell extension & completions for zsh @ ~/.zshrc