You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
# For multiple commands, upload a script and run it.
192
-
cat>"${TEMPDIR}/commit_push.sh"<<-EOF
193
-
#!/usr/bin/env bash
194
-
set -euo pipefail
195
-
if [[\$(git branch --show-current) != "${WORKSPACE_NAME}" ]]; then
196
-
git checkout -b${WORKSPACE_NAME}
197
-
fi
198
-
199
-
if [[ -z\$(git status --porcelain) ]]; then
200
-
echo "FATAL: No changes to commit"
201
-
exit 1
202
-
fi
203
-
204
-
git add -A
205
-
commit_msg=\$(echo -n 'You are a CLI utility that generates a commit message. Generate a concise git commit message for the currently staged changes. Print ONLY the commit message and nothing else.' |\${HOME}/.local/bin/claude --print)
206
-
if [[ -z "\${commit_msg}" ]]; then
207
-
commit_msg="Default commit message"
208
-
fi
209
-
git commit -am "\${commit_msg}"
210
-
git push origin${WORKSPACE_NAME}
211
-
EOF
212
-
213
-
scp \
214
-
-F"${OPENSSH_CONFIG_FILE}" \
215
-
"${TEMPDIR}/commit_push.sh" \
216
-
"${WORKSPACE_NAME}.coder:/tmp/commit_push.sh"
217
-
174
+
# We want the heredoc to be expanded locally and not remotely.
if [[\$(git branch --show-current) != "\${BRANCH}" ]]; then
185
+
git checkout -b "\${BRANCH}"
186
+
fi
187
+
188
+
if [[ -z\$(git status --porcelain) ]]; then
189
+
echo "FATAL: No changes to commit"
190
+
exit 1
191
+
fi
192
+
193
+
git add -A
194
+
commit_msg=\$(echo -n 'You are a CLI utility that generates a commit message. Generate a concise git commit message for the currently staged changes. Print ONLY the commit message and nothing else.' |\${HOME}/.local/bin/claude --print)