Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,19 @@ jobs:
to: html

- name: Publish docs
# runs when main branch is updated, or when a PR is merged into main
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site

- name: Publish PR docs in a subdirectory
# runs when a PR is opened or updated, but not when merged into main
if: github.event_name == 'pull_request' && github.base_ref == 'main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
destination_dir: ${{ github.head_ref }}

65 changes: 65 additions & 0 deletions .github/workflows/remove_pr_website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Remove PR website

on:
workflow_call:
secrets:
GITHUB_PAT:
required: false
description: GitHub API access token, which might be needed for downstream ops or rendering.
pull_request:
types:
- closed
branches:
- main

permissions:
contents: write

jobs:
delete-subfolder:
runs-on: ubuntu-latest
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
steps:
- name: Checkout repository (default branch)
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true

- name: Ensure gh-pages exists and check it out
run: |
set -euo pipefail
if git ls-remote --heads origin gh-pages | grep -q 'refs/heads/gh-pages'; then
git fetch origin gh-pages:gh-pages
git checkout gh-pages
else
echo "gh-pages branch not found. Nothing to do."
exit 0
fi
shell: bash

- name: Remove subfolder named after merged branch (if present)
run: |
set -euo pipefail
SUBDIR="${BRANCH}"
echo "SUBDIR: ${SUBDIR}"
if [ -z "$SUBDIR" ]; then
echo "Branch name empty. Nothing to do."
exit 0
fi
if [ -d "$SUBDIR" ]; then
git rm -r --ignore-unmatch -- "$SUBDIR"
if [ -n "$(git status --porcelain)" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "ci: remove gh-pages subfolder for merged branch ${BRANCH}"
git push origin gh-pages
else
echo "No changes to commit after removal."
fi
else
echo "Subfolder '$SUBDIR' does not exist on gh-pages. Nothing to do."
fi
shell: bash
2 changes: 2 additions & 0 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: "`pharmaverse` examples"
---

This paragraph is NEW!!!

The true beauty of `pharmaverse` (and open source in general) is when efforts from
various different developers come together to complement each other as a whole
greater than the sum of the individual parts. By design in R, no single package
Expand Down
Loading