mirror of
https://github.com/Untrivial-ai/agent-orchestrator.git
synced 2026-11-23 16:21:31 +08:00
fix: keep private submodule optional
Make recursive public clones skip AO Cloud by default while documenting the authorized override and testing the unauthenticated behavior in CI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ea728b86e2
commit
f5ea8c5f5a
4 files changed
+79
-1
No files matched your search
@@ -0,0 +1,31 @@
|
||||
name: Optional private submodule
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- ".gitmodules"
|
||||
- "private/ao-cloud"
|
||||
- "test/submodule/**"
|
||||
- ".github/workflows/optional-private-submodule.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".gitmodules"
|
||||
- "private/ao-cloud"
|
||||
- "test/submodule/**"
|
||||
- ".github/workflows/optional-private-submodule.yml"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
unauthenticated-recursive-clone:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
submodules: false
|
||||
|
||||
- name: Verify recursive clone skips private repository
|
||||
run: ./test/submodule/optional-private-checkout.sh
|
||||
@@ -1,3 +1,4 @@
|
||||
[submodule "private/ao-cloud"]
|
||||
path = private/ao-cloud
|
||||
url = https://github.com/Untrivial-ai/ao-cloud.git
|
||||
update = none
|
||||
@@ -18,7 +18,8 @@ with:
|
||||
|
||||
```bash
|
||||
gh auth setup-git
|
||||
git submodule update --init private/ao-cloud
|
||||
git -c submodule.private/ao-cloud.update=checkout \
|
||||
submodule update --init private/ao-cloud
|
||||
```
|
||||
|
||||
Developers without access do nothing. A normal clone, build, and test of public
|
||||
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repository_root="$(git rev-parse --show-toplevel)"
|
||||
temporary_directory="$(mktemp -d)"
|
||||
trap 'rm -rf "$temporary_directory"' EXIT
|
||||
|
||||
fixture="$temporary_directory/superproject"
|
||||
clone="$temporary_directory/clone"
|
||||
mkdir -p "$fixture/private" "$temporary_directory/home"
|
||||
git -C "$fixture" init --quiet
|
||||
cp "$repository_root/.gitmodules" "$fixture/.gitmodules"
|
||||
git -C "$fixture" add .gitmodules
|
||||
|
||||
submodule_commit="$(
|
||||
git -C "$repository_root" ls-tree HEAD private/ao-cloud |
|
||||
awk '{print $3}'
|
||||
)"
|
||||
git -C "$fixture" update-index \
|
||||
--add \
|
||||
--cacheinfo "160000,$submodule_commit,private/ao-cloud"
|
||||
git -C "$fixture" \
|
||||
-c user.name="AO CI" \
|
||||
-c user.email="ci@aoagents.dev" \
|
||||
commit --quiet --message="test optional private submodule"
|
||||
|
||||
output="$(
|
||||
HOME="$temporary_directory/home" \
|
||||
GIT_CONFIG_NOSYSTEM=1 \
|
||||
GIT_TERMINAL_PROMPT=0 \
|
||||
git -c credential.helper= clone \
|
||||
--recurse-submodules \
|
||||
"file://$fixture" \
|
||||
"$clone" 2>&1
|
||||
)"
|
||||
printf '%s\n' "$output"
|
||||
|
||||
if [[ "$output" != *"Skipping submodule 'private/ao-cloud'"* ]]; then
|
||||
echo "Recursive clone did not report skipping the private submodule." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -e "$clone/private/ao-cloud/.git" ]]; then
|
||||
echo "Recursive clone initialized the private submodule." >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in new issue
Block a user