Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/auto-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,31 @@ jobs:
token: ${{ secrets.PARENT_REPO_PAT || github.token }}

- name: Clone dependencies
shell: bash
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
git clone --depth 1 https://github.com/gitkb/loop_lib.git
for repo in loop_lib meta_core; do
url="https://github.com/gitkb/${repo}.git"
# Exit code 2 means the branch does not exist; anything else is an error
status=0
git ls-remote --exit-code --heads "$url" "refs/heads/$BRANCH" > /dev/null || status=$?
if [ "$status" -eq 0 ]; then
git clone --depth 1 -b "$BRANCH" "$url"
elif [ "$status" -eq 2 ]; then
echo "Branch ${BRANCH} not found for ${repo}; using the default branch"
git clone --depth 1 "$url"
else
echo "::error::Failed to look up ${repo}"
exit 1
fi
done

- name: Create workspace Cargo.toml
run: |
cat > Cargo.toml << 'EOF'
[workspace]
members = ["loop_cli", "loop_lib"]
members = ["loop_cli", "loop_lib", "meta_core"]
resolver = "2"

[workspace.package]
Expand Down
59 changes: 38 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,18 @@ jobs:
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
for repo in loop_lib; do
if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then
echo "Cloned ${repo}@${BRANCH}"
elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then
echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch"
for repo in loop_lib meta_core; do
url="https://github.com/gitkb/${repo}.git"
# Exit code 2 means the branch does not exist; anything else is an error
status=0
git ls-remote --exit-code --heads "$url" "refs/heads/$BRANCH" > /dev/null || status=$?
if [ "$status" -eq 0 ]; then
git clone --depth 1 -b "$BRANCH" "$url"
elif [ "$status" -eq 2 ]; then
echo "Branch ${BRANCH} not found for ${repo}; using the default branch"
git clone --depth 1 "$url"
else
echo "::error::Failed to clone ${repo}"
echo "::error::Failed to look up ${repo}"
exit 1
fi
done
Expand All @@ -46,7 +51,7 @@ jobs:
run: |
cat > Cargo.toml << 'EOF'
[workspace]
members = ["loop_cli", "loop_lib"]
members = ["loop_cli", "loop_lib", "meta_core"]
resolver = "2"

[workspace.package]
Expand Down Expand Up @@ -78,16 +83,22 @@ jobs:
path: loop_cli

- name: Clone dependencies
shell: bash
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
for repo in loop_lib; do
if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then
echo "Cloned ${repo}@${BRANCH}"
elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then
echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch"
for repo in loop_lib meta_core; do
url="https://github.com/gitkb/${repo}.git"
# Exit code 2 means the branch does not exist; anything else is an error
status=0
git ls-remote --exit-code --heads "$url" "refs/heads/$BRANCH" > /dev/null || status=$?
if [ "$status" -eq 0 ]; then
git clone --depth 1 -b "$BRANCH" "$url"
elif [ "$status" -eq 2 ]; then
echo "Branch ${BRANCH} not found for ${repo}; using the default branch"
git clone --depth 1 "$url"
else
echo "::error::Failed to clone ${repo}"
echo "::error::Failed to look up ${repo}"
exit 1
fi
done
Expand All @@ -96,7 +107,7 @@ jobs:
run: |
cat > Cargo.toml << 'EOF'
[workspace]
members = ["loop_cli", "loop_lib"]
members = ["loop_cli", "loop_lib", "meta_core"]
resolver = "2"

[workspace.package]
Expand Down Expand Up @@ -130,16 +141,22 @@ jobs:
path: loop_cli

- name: Clone dependencies
shell: bash
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
for repo in loop_lib; do
if git clone --depth 1 -b "$BRANCH" "https://github.com/gitkb/${repo}.git" 2>/dev/null; then
echo "Cloned ${repo}@${BRANCH}"
elif git clone --depth 1 "https://github.com/gitkb/${repo}.git"; then
echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch"
for repo in loop_lib meta_core; do
url="https://github.com/gitkb/${repo}.git"
# Exit code 2 means the branch does not exist; anything else is an error
status=0
git ls-remote --exit-code --heads "$url" "refs/heads/$BRANCH" > /dev/null || status=$?
if [ "$status" -eq 0 ]; then
git clone --depth 1 -b "$BRANCH" "$url"
elif [ "$status" -eq 2 ]; then
echo "Branch ${BRANCH} not found for ${repo}; using the default branch"
git clone --depth 1 "$url"
else
echo "::error::Failed to clone ${repo}"
echo "::error::Failed to look up ${repo}"
exit 1
fi
done
Expand All @@ -148,7 +165,7 @@ jobs:
run: |
cat > Cargo.toml << 'EOF'
[workspace]
members = ["loop_cli", "loop_lib"]
members = ["loop_cli", "loop_lib", "meta_core"]
resolver = "2"

[workspace.package]
Expand Down
Loading