Skip to content

Commit

Permalink
Try to adjust for if its a forked PR (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
cansavvy authored Jan 14, 2022
1 parent 645bdc5 commit d7bd6a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/render-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
rm -r docs/*
# Add remote if this is a fork
- name: Commit rendered bookdown files to preview branch
if: github.event.repository.name == 'OTTR_Template'
run: git remote add jhudsl [email protected]:jhudsl/OTTR_Template.git

# Run bookdown rendering
- name: Run bookdown render
id: bookdown
Expand Down Expand Up @@ -71,8 +76,9 @@ jobs:
echo Coursera status ${{steps.coursera.outcome}}
exit 1
# Commit the rendered bookdown files
- name: Commit rendered bookdown files to preview branch
# Commit the rendered bookdown files if this isn't to the OTTR Template
- name: Commit rendered bookdown
if: github.event.repository.name != 'OTTR_Template'
id: commit
run: |
changes=$(git diff --name-only `git log --format="%H" -n 1 origin/main` -- docs)
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/style-and-sp-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
pull_request:
branches: [ main ]

permissions: write-all

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "style and check"
Expand Down Expand Up @@ -47,6 +49,8 @@ jobs:
branch_name='preview-${{ github.event.pull_request.number }}'
git rev-parse --quiet --verify $branch_name >/dev/null && exists=true || exists=false
git remote add jhudsl [email protected]:jhudsl/OTTR_Template.git
if [[ $exists == true ]];
then
git checkout $branch_name
Expand Down

0 comments on commit d7bd6a5

Please sign in to comment.