Skip to content

Commit 39ec357

Browse files
committed
Use submodules sh
1 parent 8898a86 commit 39ec357

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

.github/actions/checkout/action.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@ runs:
1616
using: "composite"
1717

1818
steps:
19-
- uses: actions/checkout@v4
20-
with:
21-
ref: ${{ inputs.ref }}
22-
submodules: ${{ inputs.submodules-ssh-key && 'recursive' || false }}
23-
ssh-key: ${{ inputs.submodules-ssh-key }}
24-
25-
- name: Show main readme
19+
- name: Set up SSH for Git
20+
if: ${{ inputs.submodules-ssh-key }}
2621
run: |
27-
cat ./packages/sdk-components-animation/private-src/README.md || echo "No README found"
22+
mkdir -p ~/.ssh
23+
echo "${{ inputs.submodules-ssh-key }}" > ~/.ssh/id_ed25519
24+
chmod 600 ~/.ssh/id_ed25519
25+
ssh-keyscan github.com >> ~/.ssh/known_hosts
26+
shell: bash
27+
28+
- name: Verify SSH Connection (Optional)
29+
if: ${{ inputs.submodules-ssh-key }}
30+
run: ssh -T [email protected] || true
2831
shell: bash
2932

3033
- name: Try checkout submodules to the same branch as main repo
3134
if: ${{ inputs.submodules-ssh-key }}
3235
run: |
33-
git submodule foreach '
34-
BRANCH=$(git -C $toplevel rev-parse --abbrev-ref HEAD);
35-
if git ls-remote --exit-code --heads origin "$BRANCH" > /dev/null; then
36-
git checkout "$BRANCH" && git pull origin "$BRANCH";
37-
fi;'
36+
./submodules.sh
3837
shell: bash
3938

40-
- name: Show readme
39+
- name: Show main readme
40+
if: ${{ inputs.submodules-ssh-key }}
4141
run: |
4242
cat ./packages/sdk-components-animation/private-src/README.md || echo "No README found"
4343
shell: bash

.github/workflows/fixtures-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
BUILDER_HOST: ${{ inputs.builder-host }}
3131

3232
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
3336
- uses: ./.github/actions/checkout
3437
with:
3538
ref: ${{ github.event.pull_request.head.sha || github.sha }}

submodules.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
git submodule update --init --recursive
4+
5+
git submodule foreach '
6+
BRANCH=$(git -C $toplevel rev-parse --abbrev-ref HEAD);
7+
if git ls-remote --exit-code --heads origin "$BRANCH" > /dev/null; then
8+
git checkout "$BRANCH" && git pull origin "$BRANCH";
9+
else
10+
git checkout "main" && git pull origin "main";
11+
fi;'

0 commit comments

Comments
 (0)