Skip to content

[bug-hunter] move-github-dotgithub exits after first file and leaves github/ partially moved #412

Closed as not planned

Description

@github-actions

Impact

Running scripts/move-github-dotgithub.sh against a github/ tree with multiple files stops after moving only one file, returns exit code 1, and leaves the repo in a partial state (github/ still contains files).

Reproduction Steps

  1. Save and run this minimal repro script:
cat > /tmp/gh-aw/agent/repro_move_bug.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
workdir=/tmp/gh-aw/agent/repro-move-test
rm -rf "$workdir"
mkdir -p "$workdir/github/sub"
cp /home/runner/work/ai-github-actions/ai-github-actions/scripts/move-github-dotgithub.sh "$workdir/"
printf 'a' > "$workdir/github/one.txt"
printf 'b' > "$workdir/github/sub/two.txt"
cd "$workdir"
set +e
bash ./move-github-dotgithub.sh > out.txt 2>&1
code=$?
set -e
remaining=$(find github -type f | wc -l | tr -d ' ')
moved=$(find .github -type f | wc -l | tr -d ' ')
printf 'exit=%s remaining=%s moved=%s\n' "$code" "$remaining" "$moved"
cat out.txt
EOF
chmod +x /tmp/gh-aw/agent/repro_move_bug.sh
bash /tmp/gh-aw/agent/repro_move_bug.sh

Expected vs Actual

Expected: Script moves all files from github/ to .github/ and exits 0.

Actual: Script exits 1 after the first move and leaves files behind.

Observed output:

exit=1 remaining=1 moved=1
  github/sub/two.txt → .github/sub/two.txt

Failing Test

#!/usr/bin/env bash
set -euo pipefail
workdir=/tmp/gh-aw/agent/repro-move-test
rm -rf "$workdir"
mkdir -p "$workdir/github/sub"
cp /home/runner/work/ai-github-actions/ai-github-actions/scripts/move-github-dotgithub.sh "$workdir/"
printf 'a' > "$workdir/github/one.txt"
printf 'b' > "$workdir/github/sub/two.txt"
cd "$workdir"
set +e
bash ./move-github-dotgithub.sh > out.txt 2>&1
code=$?
set -e
remaining=$(find github -type f | wc -l | tr -d ' ')
moved=$(find .github -type f | wc -l | tr -d ' ')
printf 'exit=%s remaining=%s moved=%s\n' "$code" "$remaining" "$moved"
cat out.txt

Evidence

  • Increment expression under set -e: scripts/move-github-dotgithub.sh:39 uses ((count++)).
  • In Bash, ((count++)) returns status 1 when the expression evaluates to 0 (first iteration), triggering early exit with set -e.
  • Repro run confirms one file moved, one file remaining, and exit code 1.

What is this? | From workflow: Bug Hunter

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

  • expires on Mar 5, 2026, 11:27 AM UTC

Activity

  1. github-actions commented on Mar 5, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-03-05T11:27:33.975Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions