File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Generate Subdirectory List
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ jobs :
8+ build :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout repo
13+ uses : actions/checkout@v3
14+
15+ - name : Generate directories.json
16+ run : |
17+ echo "[" > directories.json
18+ for dir in */ ; do
19+ if [[ "$dir" != "assets/" && "$dir" != ".github/" ]]; then
20+ echo " \"${dir%/}\"," >> directories.json
21+ fi
22+ done
23+ sed -i '$ s/,$//' directories.json
24+ echo "]" >> directories.json
25+
26+ - name : Commit and push
27+ run : |
28+ git config user.name "github-actions[bot]"
29+ git config user.email "github-actions[bot]@users.noreply.github.com"
30+ git add directories.json
31+ git commit -m "Update directories list" || echo "No changes"
32+ git push
Original file line number Diff line number Diff line change 1+ fetch ( 'directories.json' )
2+ . then ( response => response . json ( ) )
3+ . then ( directories => {
4+ const list = document . getElementById ( "subdirectoryList" ) ;
5+ directories . forEach ( dir => {
6+ const li = document . createElement ( "li" ) ;
7+ const a = document . createElement ( "a" ) ;
8+ a . href = `${ dir } /` ;
9+ a . textContent = dir ;
10+ li . appendChild ( a ) ;
11+ list . appendChild ( li ) ;
12+ } ) ;
13+ } )
14+ . catch ( err => {
15+ console . error ( "Failed to load directories.json" , err ) ;
16+ } ) ;
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < head >
3+ < script src ="app.js "> </ script >
4+ </ head >
5+ < body >
6+ < h2 > nothing here, check out the subdirectories:</ h2 >
7+ < ul id ="subdirectoryList "> </ ul >
8+ </ body >
You can’t perform that action at this time.
0 commit comments