Skip to content

Commit

Permalink
Move fetches earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
cansavvy committed Jun 26, 2024
1 parent 9d03c78 commit fd707aa
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/render-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ jobs:
# We want a fresh run of the renders each time
- name: Delete old docs/*
run: rm -rf docs/*
run: |
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git pull --rebase --allow-unrelated-histories --strategy-option=ours
rm -rf docs/*
# Run Rmd rendering
- name: Run bookdown render
Expand Down Expand Up @@ -94,11 +98,8 @@ jobs:
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git add --force docs/*
git commit -m 'Render course' || echo "No changes to commit"
git pull --rebase --allow-unrelated-histories --strategy-option=ours --autostash
git status
git push -u origin main || echo "No changes to push"
Expand All @@ -122,6 +123,9 @@ jobs:
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git pull --rebase --allow-unrelated-histories --strategy-option=ours
# Rendered content for Leanpub and Coursera is very similar.
# This job creates a shared scaffold for both.
Expand All @@ -142,11 +146,8 @@ jobs:
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git add --force docs/no_toc*
git commit -m 'Render toc-less' || echo "No changes to commit"
git pull --rebase --allow-unrelated-histories --strategy-option=ours --autostash
git status
git push -u origin main || echo "No changes to push"
Expand All @@ -170,6 +171,9 @@ jobs:
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git pull --rebase --allow-unrelated-histories --strategy-option=ours
# Create screenshots
- name: Run the screenshot creation
Expand All @@ -190,11 +194,8 @@ jobs:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
rm -rf manuscript/
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git add .
git commit -m 'Delete manuscript folder' || echo "No changes to commit"
git pull --rebase --allow-unrelated-histories --strategy-option=ours --autostash
git status
git push -u origin main || echo "No changes to push"
Expand Down Expand Up @@ -249,6 +250,9 @@ jobs:
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git pull --rebase --allow-unrelated-histories --strategy-option=ours
# Run Coursera version
- name: Convert Leanpub quizzes to Coursera
Expand All @@ -262,8 +266,6 @@ jobs:
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
if [ -d 'coursera_quizzes' ]; then
git add --force coursera_quizzes/*
fi
Expand All @@ -272,5 +274,4 @@ jobs:
git add --force docs/*
git commit -m 'Render Coursera quizzes' || echo "No changes to commit"
git status
git pull --rebase --allow-unrelated-histories --strategy-option=ours --autostash
git push -u origin main || echo "No changes to push"

0 comments on commit fd707aa

Please sign in to comment.