Skip to content

Commit

Permalink
Fix transfer quiz repo files
Browse files Browse the repository at this point in the history
  • Loading branch information
avahoffman committed Feb 16, 2024
1 parent 6f2ce3a commit ab38930
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/transfer-rendered-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,23 @@ jobs:
if: ${{needs.yaml-check.outputs.toggle_coursera == 'yes' || needs.yaml-check.outputs.toggle_leanpub == 'yes'}}

steps:
- name: Checkout from Bookdown Repo
uses: actions/checkout@v4
with:
path: bookdown
token: ${{ secrets.GH_PAT }}

- name: Run git repo check
id: git_repo_check
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}.git/branches/${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")
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
Expand All @@ -67,6 +68,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 }}

Expand All @@ -76,17 +78,19 @@ 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 _bookdown.yml
svn export --force https://github.com/${GITHUB_REPOSITORY}.git/branches/${GITHUB_REF#refs/heads/}/_bookdown.yml _bookdown.yml
# 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 (from bookdown to quizzes repo)
cp bookdown/_bookdown.yml 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
Expand Down

0 comments on commit ab38930

Please sign in to comment.