Skip to content

Commit 10da777

Browse files
committed
fix: Fix CI
1 parent 6340f7c commit 10da777

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,15 @@ jobs:
2929
- name: Discover submodules
3030
id: discover-submodules
3131
run: |
32-
submodules=$(git submodule status --recursive | awk '{ print $2 }')
33-
# Convert submodules to JSON array format with owner/repo info
34-
matrix=$(echo "$submodules" | jq -R -s -c 'split("\n")[:-1] | map({repository: .})')
35-
echo "Submodule Matrix: $matrix"
36-
echo "::set-output name=submodule-matrix::$matrix"
32+
node ./scripts/discover-submodules.js
33+
echo "::set-output name=submodule-matrix::$(cat submodules.json)" # Set the output here
3734
3835
process-plugin:
3936
needs: build
4037
runs-on: ubuntu-latest
4138
strategy:
4239
matrix:
43-
repository: ${{ fromJson(needs.build.outputs.submodule-matrix) }}
40+
repository: ${{ fromJson(needs.build.outputs.submodule-matrix) }} # Now properly access the output
4441
steps:
4542
- name: Checkout specific submodule repository
4643
uses: actions/checkout@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
submodules.json

scripts/discover-submodules.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const { execSync } = require('child_process');
2+
const fs = require('fs');
3+
4+
let json = [];
5+
6+
try {
7+
const submoduleNames = execSync('git submodule foreach --quiet "echo $name"').toString().split('\n').filter(Boolean);
8+
const topLevelDir = execSync('git rev-parse --show-toplevel').toString().trim();
9+
10+
submoduleNames.forEach((name) => {
11+
const url = execSync(`git config --file ${topLevelDir}/.gitmodules submodule.${name}.url`).toString().trim();
12+
13+
const owner = url.replace(/https:\/\/github.com\/([^\/]+)\/.*/, '$1');
14+
const repo = url.replace(/https:\/\/github.com\/[^\/]+\/([^\/]+).*/, '$1').replace(/\.git$/, '');
15+
16+
json.push({ owner: owner, repo: repo });
17+
});
18+
}
19+
catch (error) {
20+
console.error('Error processing submodules:', error);
21+
}
22+
23+
fs.writeFileSync('submodules.json', JSON.stringify(json, null, 4));

0 commit comments

Comments
 (0)