Skip to content

debug mirror-template_repos gh action #23

debug mirror-template_repos gh action

debug mirror-template_repos gh action #23

name: mirror-template-repos
on:
push:
branches:
- main
jobs:
mirror-template-repos:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
ref: main
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Set up pandoc
uses: r-lib/actions/setup-pandoc@v1
- name: Install pandoc-citeproc
run: |
sudo apt-get install -y pandoc pandoc-citeproc
- name: Set up tinytex
uses: r-lib/actions/setup-tinytex@v2
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Quarto version
run: |
quarto --version
- name: Remove renv
# first remove renv, then install system requirements based on packages listed in DESCRIPTION
run: |
rm renv.lock
rm -r renv
rm .Rprofile
- name: Install R package dependencies (cached)
# see https://github.com/r-lib/actions/tree/v2/setup-r-dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: local::.
- name: Create template repos in separate directories
run: |
R -e 'devtools::install_local(".")'
ls ~
R -e 'library(ourproj); ourproj_start(directory = "~/workflowr_targets", project_title = "My Project", git_username = "rmgpanw", github_gitlab = "github", template = "workflowr_targets")'
ls ~
R -e 'library(ourproj); ourproj_start(directory = "~/quarto_website_targets", project_title = "My Project", git_username = "rmgpanw", github_gitlab = "github", template = "quarto_website_targets")'
- name: Create new orphan branch populated with template repo
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git checkout --orphan workflowr_targets
git reset
cp -r .git ~/workflowr_targets
rm -rf .[^.]* *
cp -r ~/workflowr_targets/. .
R -e 'fs::file_copy(path = list.files(fs::path_package("rmarkdown/templates/workflowr_analysis/skeleton", package = "ourproj"), full.names = TRUE), new_path = "analysis/my_analysis.Rmd")'
git add .
git commit -m "Initial commit"
R -e 'targets::tar_make()'
R -e 'targets::tar_meta(fields = error, complete_only = TRUE)'
git add .
git commit -m "Run targets pipeline"
git push --force origin workflowr_targets
- name: Create new orphan branch populated with quarto_website_targets template repo
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git checkout --orphan quarto_website_targets
git reset
cp -r .git ~/quarto_website_targets
rm -rf .[^.]* *
cp -r ~/quarto_website_targets/. .
git add .
git commit -m "Initial commit"
R -e 'targets::tar_make()'
R -e 'targets::tar_meta(fields = error, complete_only = TRUE)'
git add .
git commit -m "Run targets pipeline"
git push --force origin quarto_website_targets
- name: git-sync workflowr_targets
uses: morganschoen/git-sync@main
with:
source_repo: "rmgpanw/ourproj"
source_branch: "workflowr_targets"
destination_repo: "rmgpanw/workflowr_targets"
destination_branch: "main"
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} # optional
# source_ssh_private_key: ${{ secrets.SOURCE_SSH_PRIVATE_KEY }} # optional, will override `SSH_PRIVATE_KEY`
# destination_ssh_private_key: ${{ secrets.DESTINATION_SSH_PRIVATE_KEY }} # optional, will override `SSH_PRIVATE_KEY`
- name: git-sync quarto_website_targets
uses: morganschoen/git-sync@main
with:
source_repo: "rmgpanw/ourproj"
source_branch: "quarto_website_targets"
destination_repo: "rmgpanw/quarto_website_targets"
destination_branch: "main"
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} # optional
# source_ssh_private_key: ${{ secrets.SOURCE_SSH_PRIVATE_KEY }} # optional, will override `SSH_PRIVATE_KEY`
# destination_ssh_private_key: ${{ secrets.DESTINATION_SSH_PRIVATE_KEY }} # optional, will override `SSH_PRIVATE_KEY`