Skip to content

Commit 080158b

Browse files
bketelsenclaude
andcommitted
Fix skills sync: realpath -m for missing dirs, honest per-repo failures
lab has no .agents dir yet, so realpath --relative-to needed -m; and the `(...) || fail=1` guard suspended set -e inside the subshell, letting a failed PR create print "synced". Read the subshell's status after the fact instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent d13aa5a commit 080158b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

scripts/sync-skills.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for repo in $(jq -r '.repos | keys[]' "$CONFIG"); do
3535
# docs/agents — resolve to the physical dir so git pathspecs match the
3636
# files, not the symlink.
3737
skills_root=$(realpath -m "${dir}/.agents")/skills
38-
rel_root=$(realpath --relative-to="$dir" "$skills_root")
38+
rel_root=$(realpath -m --relative-to="$dir" "$skills_root")
3939

4040
for skill in "${skills[@]}"; do
4141
src=".agents/skills/${skill}"
@@ -50,7 +50,12 @@ for repo in $(jq -r '.repos | keys[]' "$CONFIG"); do
5050
"$skill" "$SRC_SHA" > "$dst/.synced-from-core"
5151
done
5252

53+
# Run the per-repo git/PR work in a subshell whose exit status we read
54+
# AFTER it finishes — `( ... ) || fail=1` would put the subshell in a
55+
# tested context, where bash suspends `set -e` and failures fall through.
56+
set +e
5357
(
58+
set -e
5459
cd "$dir"
5560
git add -A "$rel_root"
5661
if git diff --cached --quiet; then
@@ -73,7 +78,13 @@ for repo in $(jq -r '.repos | keys[]' "$CONFIG"); do
7378
--body "$(printf 'Automated skill sync from [frostyard/core](https://github.com/frostyard/core) @ %s per [ADR-0026](https://github.com/frostyard/core/blob/main/docs/adr/0026-distribute-core-skills-via-sync-prs.md).\n\nSynced skills: %s\n\nThese directories are managed in core — edit them there, not here. Local edits are overwritten by the next sync.\n\nRisk tier: 1 — documentation/skills only, no code or workflow changes.' "$SRC_SHA" "${skills[*]}")"
7479
fi
7580
echo "== ${repo}: synced"
76-
) || fail=1
81+
)
82+
rc=$?
83+
set -e
84+
if [ "$rc" -ne 0 ]; then
85+
echo "::error::sync failed for frostyard/${repo}"
86+
fail=1
87+
fi
7788
done
7889

7990
exit "$fail"

0 commit comments

Comments
 (0)