diff --git a/.github/workflows/tutorials.yml b/.github/workflows/tutorials.yml index 0ae489f..99928d5 100644 --- a/.github/workflows/tutorials.yml +++ b/.github/workflows/tutorials.yml @@ -21,27 +21,30 @@ jobs: - name: Checkout uses: actions/checkout@v4 - + - name: Get tutorials index run: | curl -L https://github.com/AdvancedPhotonSource/GSAS-II/raw/master/GSASII/tutorialIndex.py -o scripts/tutorialIndex.py ls -lt scripts pwd - + - name: save old tutorials index run: | cp tutorials.html tutorials.html.original - git status - + - name: build tutorials index run: | cd scripts python makeGitTutorial.py .. - - - name: see what has been done + + - name: see changes run: | git status + diff ../tutorials.html ../tutorials.html.original + + - name: prepare to push changes back + run: | cd .. git add tutorials.html + git add */index.html git status - diff tutorials.html tutorials.html.original diff --git a/scripts/makeGitTutorial.py b/scripts/makeGitTutorial.py index 0136ae9..3675cd4 100644 --- a/scripts/makeGitTutorial.py +++ b/scripts/makeGitTutorial.py @@ -17,9 +17,12 @@ how to retrieve this automatically any more. ''' def makeDataIndex(datadir,title): - '''Create an index.html file in the specified directory, listing the contents + '''Create an index.html file in the specified directory, + with a URL for each file in the directory. This is run on + every /data directory to provide web browser access to + the contents since GitHub does not offer allow directory views ''' - fp = open(os.path.join(datadir,'tutorials.html'),'w') + fp = open(os.path.join(datadir,'index.html'),'w') fp.write(f''' Data: {title} @@ -87,7 +90,7 @@ def makeDataIndex(datadir,title): tutURL = '' # URL of Tutorials directories, either absolute # or relative to the page being created here - outname = os.path.join(TutorialsDir,'index.html') + outname = os.path.join(TutorialsDir,'tutorials.html') dirList = [l[0] for l in G2G.tutorialIndex if len(l) >= 3]