I setup for my R package repository a pkgdown
workflow.
The .github/workflows/pkgdown.yaml
file:
on:
push:
branches: [main, master]
release:
types: [published]
workflow_dispatch:
name: pkgdown
jobs:
pkgdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-r@v1
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: pkgdown
needs: website
- name: Deploy package
if: contains(env.isPush, 'true')
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
The pkgdown
workflow works fine, but it fails to update the GitHub pages.
I setup the gh-pages
branch as explained in the GitHub documentation, so the workflow pages-build-deployment
is present, but when I push on main
branch it doesn't run.
I realized the problem was in the
if: contains(env.isPush, 'true')
line. The condition is nevertrue
norfalse
, since there is no attributeisPush
underenv
, hence the lineswere never executed.
To solve the problem, either modify the
env
part:or remove the
if
condition before therun
command.