Skip to content

Commit 136e4ee

Browse files
Added submodule export workflow
1 parent d12e97e commit 136e4ee

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.github/submodule-blacklist.txt

Whitespace-only changes.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Submodule Export Branch
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
export:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout main
17+
uses: actions/checkout@v6
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Configure git
22+
run: |
23+
git config user.name "submodule-action"
24+
git config user.email "git@liamsherwin.com"
25+
26+
- name: Set global variables
27+
run: |
28+
REPO_NAME="${GITHUB_REPOSITORY##*/}"
29+
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
30+
31+
EXPORT_BRANCH="${REPO_NAME}-submodule"
32+
echo "EXPORT_BRANCH=$EXPORT_BRANCH" >> $GITHUB_ENV
33+
34+
BLACKLIST=".github/submodule-blacklist.txt"
35+
echo "BLACKLIST=$BLACKLIST" >> $GITHUB_ENV
36+
37+
- name: Create export branch
38+
run: |
39+
git checkout -B "$EXPORT_BRANCH" origin/main
40+
41+
- name: Apply blacklist
42+
run: |
43+
if [ ! -f "$BLACKLIST" ]; then
44+
echo "Missing blacklist file: $BLACKLIST"
45+
exit 1
46+
fi
47+
48+
echo "Removing blacklisted paths:"
49+
while IFS= read -r line || [ -n "$line" ]; do
50+
[[ "$line" =~ ^#.*$ || -z "$line" ]] && continue
51+
echo "Removing: $line"
52+
rm -rf $line
53+
done < "$BLACKLIST"
54+
55+
- name: Commit Changes
56+
run: |
57+
git add -A
58+
git commit -m "Submodule Export"
59+
60+
- name: Push export branch
61+
run: |
62+
git push --set-upstream origin "$EXPORT_BRANCH" --force
63+

0 commit comments

Comments
 (0)