File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed
Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments