Skip to content

Commit 80ad558

Browse files
committed
ci: rewrite opencode submodule GitHub SSH URLs to HTTPS
1 parent 87a15db commit 80ad558

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/update-opencode-commit.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ jobs:
2020

2121
- name: Initialize opencode submodule
2222
run: |
23+
# .gitmodules tracks opencode with an SSH URL. Actions runners
24+
# typically lack SSH deploy keys, so force GitHub remotes to HTTPS.
25+
git config --global --add url."https://github.com/".insteadOf git@github.com:
26+
git config --global --add url."https://github.com/".insteadOf ssh://git@github.com/
2327
git submodule sync --recursive
24-
git -c url."https://github.com/".insteadOf=git@github.com: submodule update --init --recursive packages/opencode
28+
git submodule update --init --recursive packages/opencode
2529
git submodule status --recursive
2630
2731
- name: Configure Git

scripts/update-opencode-commit.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ if [[ -f "${gitmodules}" ]]; then
3232
fi
3333
fi
3434

35-
git -C "${submodule_dir}" fetch --prune origin "${submodule_branch}"
35+
# In GitHub Actions, submodule URLs may be SSH-style from .gitmodules
36+
# (git@github.com:...), but runners usually do not have an SSH key.
37+
# Rewrite those URLs to HTTPS for this fetch so CI can read the repo.
38+
git \
39+
-C "${submodule_dir}" \
40+
-c url."https://github.com/".insteadOf=git@github.com: \
41+
-c url."https://github.com/".insteadOf=ssh://git@github.com/ \
42+
fetch --prune origin "${submodule_branch}"
3643
latest_commit="$(git -C "${submodule_dir}" rev-parse FETCH_HEAD)"
3744
if [[ -z "${latest_commit}" ]]; then
3845
echo "Failed to resolve latest commit for branch ${submodule_branch}." >&2

0 commit comments

Comments
 (0)