From 4b96bb08dbbde51901024cedf9e96253c77fa7fe Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Mon, 16 Mar 2026 10:07:18 +0000 Subject: [PATCH 1/2] #1 test: add PR website --- .github/workflows/docs.yaml | 11 +++++ .github/workflows/remove_pr_website.yml | 65 +++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/remove_pr_website.yml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 63481c25..cc722755 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -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 }} + diff --git a/.github/workflows/remove_pr_website.yml b/.github/workflows/remove_pr_website.yml new file mode 100644 index 00000000..b79aa4da --- /dev/null +++ b/.github/workflows/remove_pr_website.yml @@ -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 \ No newline at end of file From 6a751e928e1345794c4d771b8ae5ecaaa69b0449 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss Date: Mon, 16 Mar 2026 10:08:57 +0000 Subject: [PATCH 2/2] #1 test: modify website --- index.qmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.qmd b/index.qmd index 42550b4e..c84d210b 100644 --- a/index.qmd +++ b/index.qmd @@ -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