Skip to content

Commit 80d982f

Browse files
committed
fix(github-workflows): replace --body-file temp files with inline heredoc
Skill instructions were directing agents to write PR bodies to temp files (mktemp + Write tool + --body-file + rm) before passing them to gh commands. Replace with the --body "$(cat <<'EOF' ... EOF)" pattern, which eliminates the temp file lifecycle entirely. Add cspell word 'oneline' to fix a pre-existing spell check failure on the git log --oneline command. (claude)
1 parent b099278 commit 80d982f

4 files changed

Lines changed: 22 additions & 12 deletions

File tree

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"mvexpand",
2323
"mvfilter",
2424
"nullglob",
25+
"oneline",
2526
"pids",
2627
"recognises",
2728
"reinvocation",

github-workflows/skills/finalize-pr/SKILL.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,16 @@ Steps 4.1 and 4.2 run sequentially within the agent. Step 4.3 runs after both.
177177

178178
### 4.3 Apply Updates
179179

180-
After 4.1 and 4.2 complete, write the body to a temp file and apply with `gh pr edit --body-file`
181-
(safer than inline for multiline content).
180+
After 4.1 and 4.2 complete, apply directly — no temp files:
181+
182+
```bash
183+
gh pr edit {number} --body "$(cat <<'EOF'
184+
... generated body ...
185+
EOF
186+
)"
187+
```
188+
189+
Single-quoted `'EOF'` prevents shell expansion. Closing `EOF` must be alone on its own line with no leading whitespace.
182190

183191
Proceed to Phase 5.
184192

github-workflows/skills/squash-merge-pr/SKILL.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,12 @@ Generate:
4848

4949
Types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`
5050

51-
Store the title in a shell variable and write the body to a temp file using the Write tool
52-
(avoids shell quoting issues with multi-line text):
51+
Store the title in a shell variable:
5352

5453
```bash
5554
SQUASH_TITLE="<generated title>"
56-
SQUASH_BODY_FILE=$(mktemp)
5755
```
5856

59-
Use the Write tool to write the generated body text to the path stored in `$SQUASH_BODY_FILE`.
60-
6157
## Step 3: Execute Squash Merge
6258

6359
Capture the branch name before merging (needed for cleanup):
@@ -66,13 +62,18 @@ Capture the branch name before merging (needed for cleanup):
6662
BRANCH=$(gh pr view {pr} --json headRefName --jq '.headRefName')
6763
```
6864

69-
Merge without `--delete-branch` (avoids `git switch` failure in bare+worktree repos):
65+
Merge without `--delete-branch` (avoids `git switch` failure in bare+worktree repos).
66+
Use a heredoc for the body — no temp files:
7067

7168
```bash
72-
gh pr merge {pr} --squash --subject "$SQUASH_TITLE" --body-file "$SQUASH_BODY_FILE"
73-
rm -f "$SQUASH_BODY_FILE"
69+
gh pr merge {pr} --squash --subject "$SQUASH_TITLE" --body "$(cat <<'EOF'
70+
... generated body ...
71+
EOF
72+
)"
7473
```
7574

75+
Single-quoted `'EOF'` prevents shell expansion. Closing `EOF` must be alone on its own line with no leading whitespace.
76+
7677
Delete the remote branch (GitHub may have auto-deleted it on merge — `|| true` handles that):
7778

7879
```bash

tests/content-guards/enforce-issue-limits/enforce-issue-limits.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ run_hook() {
163163
[ "$status" -eq 0 ]
164164
}
165165

166-
@test "TC7b: gh pr edit with --body-file is always allowed" {
166+
@test "TC7b: gh pr edit with --body is always allowed" {
167167
local now
168168
now="$(utc_now)"
169169
export GH_RESPONSE="$(build_json_array '{"createdAt":"'"$now"'"}' 25)"
170170

171-
run_hook '{"tool_input":{"command":"gh pr edit 126 --body-file /tmp/pr-body.md"}}'
171+
run_hook '{"tool_input":{"command":"gh pr edit 126 --body \"updated description\""}}'
172172
[ "$status" -eq 0 ]
173173
}
174174

0 commit comments

Comments
 (0)