Fix vignette #269
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- "master" | |
pull_request: | |
branches: | |
- "*" | |
name: vignette | |
env: | |
cache-version: "cache-v2" | |
jobs: | |
check-permissions: | |
runs-on: ubuntu-latest | |
outputs: | |
has_permission: ${{ steps.check_permissions.outputs.has_permission }} | |
steps: | |
- name: Check if actor has permission | |
id: check_permissions | |
run: | | |
# Define allowed actors | |
ALLOWED_ACTORS=("zktuong" "Jiawei-Yu10") # Replace these with the actual GitHub usernames | |
if [[ " ${ALLOWED_ACTORS[@]} " =~ " ${GITHUB_ACTOR} " ]]; then | |
echo "has_permission=true" >> $GITHUB_OUTPUT | |
else | |
echo "has_permission=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Debug permissions output | |
run: | | |
echo "Has permission: ${{ steps.check_permissions.outputs.has_permission }}" | |
vignette: | |
needs: | |
- check-permissions | |
if: needs.check-permissions.outputs.has_permission == 'true' | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
matrix: | |
config: | |
- { os: ubuntu-latest } | |
runs-on: ${{ matrix.config.os }} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup R and Bioconductor | |
uses: grimbough/bioc-actions/setup-bioc@v1 | |
id: install-r | |
with: | |
bioc-version: release | |
- name: Get R version | |
id: R | |
run: | | |
R --version > VERSION | |
echo "version=$(head -1 VERSION | awk '{print $3}')" >> $GITHUB_OUTPUT | |
shell: bash -l {0} | |
- name: Get Bioconductor version | |
id: BIOC | |
run: | | |
echo "version=$R_BIOC_VERSION" >> $GITHUB_OUTPUT | |
shell: bash -l {0} | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Cache R packages | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/work/_temp/Library | |
key: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-${{ steps.BIOC.outputs.version}}-r-${{ steps.R.outputs.version}}-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-${{ steps.BIOC.outputs.version}}-r-${{ steps.R.outputs.version}}- | |
- name: Install specific version of pillar to avoid weird error message | |
run: | | |
Rscript -e 'remotes::install_version("pillar", "1.9.0")' | |
shell: bash -l {0} | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: pkgdown | |
- name: Install scRepertoire from github | |
run: | | |
Rscript -e 'remotes::install_github("ncborcherding/scRepertoire")' | |
shell: bash -l {0} | |
- name: Install package | |
run: R CMD INSTALL . | |
- name: Configure git | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
- name: Build and publish vignette | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
run: | | |
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' | |
shell: bash -l {0} | |
# If events is a PR, set subdir to 'preview/pr<pr_number>' | |
- name: "[PR] Set documentation subdirectory" | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "PKGDOWN_DEV_MODE=unreleased" >> $GITHUB_ENV | |
echo "subdir=preview/pr${{ github.event.number }}" >> $GITHUB_ENV | |
- name: Deploy pkgdown site | |
id: deploy | |
shell: Rscript {0} | |
run: | | |
subdir <- "${{ env.subdir }}" | |
pkg <- pkgdown::as_pkgdown(".") | |
# Deploy pkgdown site to branch | |
pkgdown::deploy_to_branch(subdir = if (nzchar(subdir)) subdir, clean = nzchar(subdir)) | |
# Report deployed site URL | |
deployed_url <- file.path(pkg$meta$url, subdir) | |
cat(sprintf('url=%s', deployed_url), file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE) | |
- name: Notify pkgdown deployment | |
if: github.event_name == 'pull_request' | |
uses: hasura/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.number }} | |
id: pkgdown-deploy | |
append: false | |
message: > | |
:book: ${{ steps.deploy.outputs.url }} | |
Preview documentation for this PR (at commit ${{ github.event.pull_request.head.sha }}) |