From fb27673701879ba17a4fc43fc2afd6b29b98accc Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 12:21:01 -0500 Subject: [PATCH 01/12] Tiny path change to hopefully fix broken quiz rendering --- .github/workflows/transfer-rendered-files.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index e698d987..732a2883 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -54,7 +54,7 @@ jobs: echo $QUIZ_REPO # Get repo check script - svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R + svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R # Run repo check script results=$(Rscript --vanilla git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") From e6aaf950ac5d2cc23ff41bde3e3d790156f0c7a1 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 12:44:46 -0500 Subject: [PATCH 02/12] Different solution --- .github/workflows/transfer-rendered-files.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index 732a2883..0397d03e 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -54,7 +54,8 @@ jobs: echo $QUIZ_REPO # Get repo check script - svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R + # svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R + wget https://github.com/jhudsl/OTTR_Template/blob/main/scripts/git_repo_check.R # Run repo check script results=$(Rscript --vanilla git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") From e292cfdb8b1734f5f596972df2f897a4c734637c Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 12:54:08 -0500 Subject: [PATCH 03/12] Use raw file --- .github/workflows/transfer-rendered-files.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index 0397d03e..6841a350 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -55,7 +55,7 @@ jobs: # Get repo check script # svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R - wget https://github.com/jhudsl/OTTR_Template/blob/main/scripts/git_repo_check.R + wget https://raw.githubusercontent.com/jhudsl/OTTR_Template/main/scripts/git_repo_check.R # Run repo check script results=$(Rscript --vanilla git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") From fafb2a0d6e3d51b8b58933c14978a214782ec85b Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 12:59:55 -0500 Subject: [PATCH 04/12] Try Checkout approach --- .github/workflows/transfer-rendered-files.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index 6841a350..a353eb18 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -42,6 +42,11 @@ jobs: if: ${{needs.yaml-check.outputs.toggle_coursera == 'yes' || needs.yaml-check.outputs.toggle_leanpub == 'yes'}} steps: + - name: checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_PAT }} + - name: Run git repo check id: git_repo_check env: @@ -55,10 +60,10 @@ jobs: # Get repo check script # svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R - wget https://raw.githubusercontent.com/jhudsl/OTTR_Template/main/scripts/git_repo_check.R + # wget https://raw.githubusercontent.com/jhudsl/OTTR_Template/main/scripts/git_repo_check.R # Run repo check script - results=$(Rscript --vanilla git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") + results=$(Rscript --vanilla scripts/git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") echo $QUIZ_REPO exists: $results echo "git_results=$results" >> $GITHUB_OUTPUT From bae5593e3b0b5ec05ec3508728afcc973df0b0da Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 13:23:28 -0500 Subject: [PATCH 05/12] Seeing what checking out two repos functinoally looks like --- .github/workflows/transfer-rendered-files.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index a353eb18..f66c1c00 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -52,7 +52,7 @@ jobs: env: GH_PAT: ${{ secrets.GH_PAT }} run: | - sudo apt-get install subversion + # sudo apt-get install subversion # What's the Quizzes repository's name? QUIZ_REPO=$(echo ${GITHUB_REPOSITORY} | sed "s/_Bookdown/ /g" | sed "s/_Template/ /g" | awk '{print $1"_Quizzes"}') @@ -61,6 +61,7 @@ jobs: # Get repo check script # svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R # wget https://raw.githubusercontent.com/jhudsl/OTTR_Template/main/scripts/git_repo_check.R + ls -a # Run repo check script results=$(Rscript --vanilla scripts/git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") @@ -75,6 +76,14 @@ jobs: with: repository: ${{ steps.git_repo_check.outputs.leanpub_repo }} token: ${{ secrets.GH_PAT }} + + - name: Scope out Files + id: git_repo_check_2 + env: + GH_PAT: ${{ secrets.GH_PAT }} + run: | + ls -a + ls -a ../ - name: Get files from Bookdown repo if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} @@ -83,10 +92,10 @@ jobs: GH_PAT: ${{ secrets.GH_PAT }} run: | # Copy over images folder - svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/resources/chapt_screen_images resources/chapt_screen_images + # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/resources/chapt_screen_images resources/chapt_screen_images # Copy over _bookdown.yml - svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/_bookdown.yml _bookdown.yml + # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/_bookdown.yml _bookdown.yml - name: Create PR with resources files if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} From 39da3a5fbb6bbb1640293899c38e132dac5d0088 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 13:30:15 -0500 Subject: [PATCH 06/12] Seeing what can be done with different paths --- .github/workflows/transfer-rendered-files.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index f66c1c00..59cdadac 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -45,6 +45,7 @@ jobs: - name: checkout uses: actions/checkout@v4 with: + path: main token: ${{ secrets.GH_PAT }} - name: Run git repo check @@ -61,6 +62,7 @@ jobs: # Get repo check script # svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R # wget https://raw.githubusercontent.com/jhudsl/OTTR_Template/main/scripts/git_repo_check.R + echo "main repo" ls -a # Run repo check script @@ -74,6 +76,7 @@ jobs: if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} uses: actions/checkout@v4 with: + path: quizzes repository: ${{ steps.git_repo_check.outputs.leanpub_repo }} token: ${{ secrets.GH_PAT }} @@ -82,7 +85,9 @@ jobs: env: GH_PAT: ${{ secrets.GH_PAT }} run: | + echo "current:" ls -a + echo "up one:" ls -a ../ - name: Get files from Bookdown repo From d9536da0d763f70432e1466f633ad63b8a42e2f0 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 13:34:17 -0500 Subject: [PATCH 07/12] Fix path, I think I know what's happening --- .github/workflows/transfer-rendered-files.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index 59cdadac..65a17d37 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -45,7 +45,7 @@ jobs: - name: checkout uses: actions/checkout@v4 with: - path: main + path: bookdown token: ${{ secrets.GH_PAT }} - name: Run git repo check @@ -62,11 +62,9 @@ jobs: # Get repo check script # svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R # wget https://raw.githubusercontent.com/jhudsl/OTTR_Template/main/scripts/git_repo_check.R - echo "main repo" - ls -a # Run repo check script - results=$(Rscript --vanilla scripts/git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") + results=$(Rscript --vanilla bookdown/scripts/git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") echo $QUIZ_REPO exists: $results echo "git_results=$results" >> $GITHUB_OUTPUT From 05e63624103fb684e3e2e6b209047e11da77c560 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 13:43:17 -0500 Subject: [PATCH 08/12] Fix file creation --- .github/workflows/transfer-rendered-files.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index 65a17d37..ca5e2910 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -96,9 +96,12 @@ jobs: run: | # Copy over images folder # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/resources/chapt_screen_images resources/chapt_screen_images - + mkdir -p quizzes/resources/chapt_screen_images + cp bookdown/resources/chapt_screen_images/* quizzes/resources/chapt_screen_images + # Copy over _bookdown.yml # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/_bookdown.yml _bookdown.yml + cp bookdown/_bookdown.yml quizzes/_bookdown.yml - name: Create PR with resources files if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} From 2453d6e078007cabce6c81bf1406fef170ad5863 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 13:48:04 -0500 Subject: [PATCH 09/12] do some error checking --- .github/workflows/transfer-rendered-files.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index ca5e2910..e6f8d62f 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -77,16 +77,6 @@ jobs: path: quizzes repository: ${{ steps.git_repo_check.outputs.leanpub_repo }} token: ${{ secrets.GH_PAT }} - - - name: Scope out Files - id: git_repo_check_2 - env: - GH_PAT: ${{ secrets.GH_PAT }} - run: | - echo "current:" - ls -a - echo "up one:" - ls -a ../ - name: Get files from Bookdown repo if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} @@ -98,16 +88,22 @@ jobs: # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/resources/chapt_screen_images resources/chapt_screen_images mkdir -p quizzes/resources/chapt_screen_images cp bookdown/resources/chapt_screen_images/* quizzes/resources/chapt_screen_images + echo "Are files present?" + la -a quizzes/resources/chapt_screen_images # Copy over _bookdown.yml # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/_bookdown.yml _bookdown.yml cp bookdown/_bookdown.yml quizzes/_bookdown.yml + echo "Are files present?" + la -a quizzes/_bookdown.yml + - name: Create PR with resources files if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} uses: peter-evans/create-pull-request@v3 id: cpr with: + path: quizzes # Must create the PR in the Quizzes Repo token: ${{ secrets.GH_PAT }} commit-message: Copy files from Bookdown repository signoff: false From ab4e866eb37a7744788440345ef56f48df890088 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 13:52:30 -0500 Subject: [PATCH 10/12] omg ls not la --- .github/workflows/transfer-rendered-files.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index e6f8d62f..d6082719 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -89,13 +89,13 @@ jobs: mkdir -p quizzes/resources/chapt_screen_images cp bookdown/resources/chapt_screen_images/* quizzes/resources/chapt_screen_images echo "Are files present?" - la -a quizzes/resources/chapt_screen_images + ls -a quizzes/resources/chapt_screen_images # Copy over _bookdown.yml # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/_bookdown.yml _bookdown.yml cp bookdown/_bookdown.yml quizzes/_bookdown.yml echo "Are files present?" - la -a quizzes/_bookdown.yml + ls -a quizzes/_bookdown.yml - name: Create PR with resources files From 33d417e4440a4baf091d01d2fbedb7057e664483 Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 14:43:24 -0500 Subject: [PATCH 11/12] Clean up logging --- .github/workflows/transfer-rendered-files.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index d6082719..29c78eaf 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -53,16 +53,10 @@ jobs: env: GH_PAT: ${{ secrets.GH_PAT }} run: | - # sudo apt-get install subversion - # What's the Quizzes repository's name? QUIZ_REPO=$(echo ${GITHUB_REPOSITORY} | sed "s/_Bookdown/ /g" | sed "s/_Template/ /g" | awk '{print $1"_Quizzes"}') echo $QUIZ_REPO - # Get repo check script - # svn export --force https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF#refs/heads/}/scripts/git_repo_check.R git_repo_check.R - # wget https://raw.githubusercontent.com/jhudsl/OTTR_Template/main/scripts/git_repo_check.R - # Run repo check script results=$(Rscript --vanilla bookdown/scripts/git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") echo $QUIZ_REPO exists: $results @@ -88,15 +82,10 @@ jobs: # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/resources/chapt_screen_images resources/chapt_screen_images mkdir -p quizzes/resources/chapt_screen_images cp bookdown/resources/chapt_screen_images/* quizzes/resources/chapt_screen_images - echo "Are files present?" - ls -a quizzes/resources/chapt_screen_images # Copy over _bookdown.yml # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/_bookdown.yml _bookdown.yml cp bookdown/_bookdown.yml quizzes/_bookdown.yml - echo "Are files present?" - ls -a quizzes/_bookdown.yml - - name: Create PR with resources files if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} From 3109fd301c6f37c7a3632911820a25c20acbe3ec Mon Sep 17 00:00:00 2001 From: avahoffman Date: Fri, 16 Feb 2024 14:45:41 -0500 Subject: [PATCH 12/12] Remove all svn stuff --- .github/workflows/transfer-rendered-files.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index 29c78eaf..e439e4be 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -78,13 +78,11 @@ jobs: env: GH_PAT: ${{ secrets.GH_PAT }} run: | - # Copy over images folder - # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/resources/chapt_screen_images resources/chapt_screen_images + # Copy over images folder (from bookdown to quizzes repo) mkdir -p quizzes/resources/chapt_screen_images cp bookdown/resources/chapt_screen_images/* quizzes/resources/chapt_screen_images - # Copy over _bookdown.yml - # svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/_bookdown.yml _bookdown.yml + # Copy over _bookdown.yml (from bookdown to quizzes repo) cp bookdown/_bookdown.yml quizzes/_bookdown.yml - name: Create PR with resources files