Skip to content

Commit 6f366ba

Browse files
committed
Update pr.yml
1 parent b929d14 commit 6f366ba

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

.github/workflows/pr.yml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,70 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13-
test-build:
13+
prepare:
1414
runs-on: ubuntu-latest
1515

16+
outputs:
17+
submodule-matrix: ${{ steps.discover-submodules.outputs.submodule-matrix }}
1618
steps:
1719
- name: Checkout repository
1820
uses: actions/checkout@v4
1921
with:
22+
submodules: recursive
2023
repository: ${{ github.event.pull_request.head.repo.full_name }}
2124
ref: ${{ github.event.pull_request.head.ref }}
2225
persist-credentials: false
2326
fetch-depth: 0
27+
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v2
30+
with:
31+
node-version: '20'
32+
33+
- name: Install pnpm
34+
run: npm install -g pnpm
35+
36+
- name: Discover submodules
37+
id: discover-submodules
38+
run: |
39+
sudo node ./scripts/generate-metadata.js
40+
sudo node ./scripts/discover-submodules.js > submodules.json
41+
cat submodules.json
42+
43+
echo "submodule-matrix=$(cat submodules.json)" >> $GITHUB_OUTPUT
44+
45+
- name: Commit Metadata
46+
if: github.event_name != 'pull_request' && github.event.repository.fork == false
47+
run: |
48+
git config --global user.name 'github-actions[bot]'
49+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
50+
51+
# Stage the changes
52+
git add metadata.json
53+
54+
# Commit only if there are changes
55+
if git commit -m "chore: Add plugin metadata"; then
56+
# Push only if the commit succeeded
57+
git push
58+
else
59+
echo "::debug::No changes to commit."
60+
fi
61+
62+
make:
63+
needs: prepare
64+
runs-on: ubuntu-latest
65+
strategy:
66+
fail-fast: false
67+
matrix: ${{ fromJson(needs.prepare.outputs.submodule-matrix) }}
68+
name: Build (${{ matrix.submodules.repository }})
69+
steps:
70+
- name: Checkout Repository
71+
uses: actions/checkout@v4
72+
with:
73+
repository: ${{ matrix.submodules.repository }}
74+
ref: ${{ matrix.submodules.sha }}
75+
token: ${{ secrets.GITHUB_TOKEN }}
76+
fetch-depth: 0
2477
submodules: recursive
2578

2679
- name: Set up Node.js

0 commit comments

Comments
 (0)