Skip to content

Commit

Permalink
Merge pull request #42 from NIEHS/staging-internal
Browse files Browse the repository at this point in the history
July version updates
  • Loading branch information
larapclark authored Aug 2, 2024
2 parents c41b148 + 988bf11 commit 513b5a2
Show file tree
Hide file tree
Showing 162 changed files with 4,305 additions and 13,019 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
# Need help debugging build failures?
# Start at https://github.com/r-lib/actions#where-to-find-help
---
name: Render Bookdown
name: Check Render Bookdown

on:
push:
branches: [master, main]
pull_request:

jobs:
test-render-bookdown:
check_render_bookdown:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
Expand All @@ -26,11 +28,6 @@ jobs:
sudo apt-get install -y libudunits2-dev libgdal-dev
sudo apt-get install libmagick++-dev
- name: Install pandoc-citeproc
run: |
sudo apt-get update
sudo apt-get install pandoc-citeproc
- uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
name: Super Linter
name: Check Super Linter

on:
push:
pull_request:

jobs:
super-lint:
name: Lint all file types
check_super_linter:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -23,5 +22,5 @@ jobs:
- name: Run Super-Linter
uses: github/super-linter@v4
env:
FILTER_REGEX_EXCLUDE: .*/docs/*
FILTER_REGEX_EXCLUDE: .*/docs/.*|.*/.github/workflows/.*
LINTR_ERROR_ON_LINT: true
82 changes: 82 additions & 0 deletions .github/workflows/deploy-toolkit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
# ---
# name: Deploy Toolkit

# on:
# push:
# branches: [main, master]
# pull_request:
# branches: [main, master]
# release:
# types: [published]
# workflow_dispatch:

# jobs:
# deploy_toolkit:
# runs-on: ubuntu-latest

# # Only restrict concurrency for non-PR jobs
# concurrency:
# group: bookdown-${{ github.event_name != 'pull_request' || github.run_id }}

# env:
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

# permissions:
# contents: write

# steps:
# - uses: actions/checkout@v4

# - uses: r-lib/actions/setup-pandoc@v2

# - uses: r-lib/actions/setup-r@v2
# with:
# use-public-rspm: true

# - name: Install libudunits2 and libmagick
# run: |
# sudo apt-get install -y libudunits2-dev libgdal-dev
# sudo apt-get install libmagick++-dev

# - name: Build site
# run: |
# install.packages(c(
# "bookdown",
# "rmarkdown",
# "plotly",
# "shiny",
# "tidycensus",
# "tidyverse",
# "viridis",
# "ggmap",
# "ggplot2",
# "maps",
# "dplyr",
# "knitr",
# "latticeExtra",
# "pals",
# "classInt",
# "sf",
# "udunits2",
# "tmap",
# "lubridate",
# "gifski",
# "magick",
# "cowplot",
# "BiocManager"
# ),
# dependencies = TRUE
# )
# BiocManager::install("Biobase")
# bookdown::render_book()
# shell: Rscript {0}

# - name: Deploy to GitHub pages 🚀
# if: github.event_name != 'pull_request'
# uses: JamesIves/[email protected]
# with:
# clean: false
# branch: gh-pages
# folder: docs
34 changes: 34 additions & 0 deletions .github/workflows/protect-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Protect Branch `main`

on:
pull_request:

jobs:
protect_main:
runs-on: ubuntu-latest

steps:
- name: Check base branch
id: check-base-branch
run: |
if [[ "${{ github.event.pull_request.base.ref }}" == "main" || "${{ github.event.pull_request.base.ref }}" == "master" ]]; then
echo "Protected branch \"main\" detected in pull request."
echo "continue=true" >> "$GITHUB_OUTPUT"
else
echo "Protected branch \"main\" not detected in pull request."
echo "continue=false" >> "$GITHUB_OUTPUT"
fi
- name: Check source branch
run: |
continue="${{ steps.check-base-branch.outputs.continue }}"
if [[ "$continue" == "true" ]]; then
source_branch=$(jq -r '.pull_request.head.ref' "$GITHUB_EVENT_PATH")
if [[ "$source_branch" != "staging-public" ]]; then
echo "Pull requests into \"main\" must come from \"staging-public\"."
exit 1
fi
else
echo "Protected branch \"main\" not detected in pull request."
fi
34 changes: 34 additions & 0 deletions .github/workflows/protect-staging-public.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Protect Branch `staging-public`

on:
pull_request:

jobs:
protect_staging_public:
runs-on: ubuntu-latest

steps:
- name: Check base branch
id: check-base-branch
run: |
if [[ "${{ github.event.pull_request.base.ref }}" == "staging-public" ]]; then
echo "Protected branch \"staging-public\" detected in pull request."
echo "continue=true" >> "$GITHUB_OUTPUT"
else
echo "Protected branch \"staging-public\" not detected in pull request."
echo "continue=false" >> "$GITHUB_OUTPUT"
fi
- name: Check source branch
run: |
continue="${{ steps.check-base-branch.outputs.continue }}"
if [[ "$continue" == "true" ]]; then
source_branch=$(jq -r '.pull_request.head.ref' "$GITHUB_EVENT_PATH")
if [[ "$source_branch" != "staging-internal" ]]; then
echo "Pull requests into \"staging-public\" must come from \"staging-internal\"."
exit 1
fi
else
echo "Protected branch \"staging-public\" not detected in pull request."
fi
49 changes: 49 additions & 0 deletions .github/workflows/update-staging-external.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# workflow to update external repository hosting staging webpage
---
name: Update external repository `PCOR_bookdown_staging`

on:
push:
branches: [staging-internal]

jobs:
sync:
runs-on: ubuntu-latest

steps:
- name: Checkout `PCOR_public` repository
uses: actions/checkout@v3
with:
ref: staging-internal

- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Clone the staging repository
run: |
cd ../
git clone https://${{ secrets.PCOR_bookdown_staging_actions_06262024 }}@github.com/NIEHS/PCOR_bookdown_staging.git
cd PCOR_bookdown_staging
git checkout main
cd ../
- name: Check directory debug
run: |
cd ../
pwd
ls -l
- name: Sync files
run: |
cd ../
rsync -av --checksum --ignore-missing-args --exclude='.git' --exclude='.github' --exclude='.gitignore' --exclude='README.md' --delete ./PCOR_bookdown_tools/ ./PCOR_bookdown_staging/ || true
cd PCOR_bookdown_staging
git add .
git status
git commit -m "Sync PCOR_public staging-internal branch" || echo "No changes to commit"
git push https://${{ secrets.PCOR_bookdown_staging_actions_06262024 }}@github.com/NIEHS/PCOR_bookdown_staging.git main
env:
GITHUB_PAT: ${{ secrets.PCOR_bookdown_staging_actions_06262024 }}
22 changes: 22 additions & 0 deletions .github/workflows/update-staging-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ---
# name: Update Branch `staging-internal`

# on:
# push:
# branches: [staging-public]

# jobs:
# update_staging_internal:
# runs-on: ubuntu-latest

# if: github.event_name == 'push' && contains(github.event.head_commit.message, 'Merge pull request')

# steps:
# - name: Checkout code
# uses: actions/checkout@v2

# - name: Delete old branch
# run: |
# git push origin --delete staging-internal || true
# git checkout -b staging-internal
# git push origin staging-internal
22 changes: 22 additions & 0 deletions .github/workflows/update-staging-public.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ---
# name: Update Branch `staging-public`

# on:
# push:
# branches: [main, master]

# jobs:
# update_staging_public:
# runs-on: ubuntu-latest

# if: github.event_name == 'push' && contains(github.event.head_commit.message, 'Merge pull request')

# steps:
# - name: Checkout code
# uses: actions/checkout@v2

# - name: Delete old branch
# run: |
# git push origin --delete staging-public || true
# git checkout -b staging-public
# git push origin staging-public
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ _book/
_bookdown_files/
_main_files
.DS_Store
docs/
Loading

0 comments on commit 513b5a2

Please sign in to comment.