Skip to content

[bug-hunter] move-github-dotgithub exits after moving only first file #1838

Closed as not planned

Description

@github-actions

Impact

scripts/move-github-dotgithub.sh exits with code 1 after moving only the first file from github/ to .github/, leaving the rest unmoved. This breaks the script’s core purpose in repos where github/ contains multiple files.

The failure is triggered by set -e combined with arithmetic status semantics at:

  • scripts/move-github-dotgithub.sh:39 (((count++)))

With count=0, ((count++)) evaluates to 0 and returns non-zero status, so the script aborts immediately.

Reproduction Steps

  1. Run this exact script in a clean temp directory:
#!/usr/bin/env bash
set -euo pipefail

WORK=/tmp/gh-aw/agent/repro-move-count
rm -rf "$WORK"
mkdir -p "$WORK"
cd "$WORK"

git init -q
mkdir -p github/dir
printf 'a' > github/a.txt
printf 'b' > github/dir/b.txt

set +e
bash /home/runner/work/ai-github-actions/ai-github-actions/scripts/move-github-dotgithub.sh >out.txt 2>&1
code=$?
set -e

echo "exit_code=$code"
echo "--- script output ---"
cat out.txt
echo "--- filesystem after run ---"
find . -maxdepth 3 -type f | sort

Expected vs Actual

Expected:

  • Script exits 0
  • Both files are moved to .github/
  • Nothing remains under github/

Actual:

  • Script exits 1
  • Only first file is moved
  • Remaining files are left under github/

Observed output:

exit_code=1
--- script output ---
  github/a.txt → .github/a.txt
--- filesystem after run ---
./.github/a.txt
./github/dir/b.txt

Failing Test

#!/usr/bin/env bash
set -euo pipefail

WORK=/tmp/gh-aw/agent/repro-move-count
rm -rf "$WORK"
mkdir -p "$WORK"
cd "$WORK"

git init -q
mkdir -p github/dir
printf 'a' > github/a.txt
printf 'b' > github/dir/b.txt

set +e
bash /home/runner/work/ai-github-actions/ai-github-actions/scripts/move-github-dotgithub.sh >out.txt 2>&1
code=$?
set -e

# Fails today: should be 0 and should move both files
[ "$code" -eq 0 ]
[ ! -e github/dir/b.txt ]
[ -e .github/a.txt ]
[ -e .github/dir/b.txt ]

Evidence

  • Code path: scripts/move-github-dotgithub.sh:8 enables set -e, and scripts/move-github-dotgithub.sh:39 uses ((count++)).
  • Bash arithmetic behavior under set -e is reproducible independently (count=0; ((count++)) returns non-zero).
  • This matches current HEAD behavior in a minimal local reproduction.

Related historical context: PR #415 attempted to fix this path but was closed unmerged, and the bug is still reproducible on current HEAD.


What is this? | From workflow: Trigger Bug Hunter

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

  • expires on Aug 24, 2026, 11:17 AM UTC

Activity

  1. added a commit that references this issue on Aug 17, 2026
    a1e0e02
  2. github-actions commented on Aug 24, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-08-24T11:17:19.442Z.

    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