Run checks on update_datasets change, but report success early. #142
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
# 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 | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
name: pkgdown | ||
jobs: | ||
pkgdown: | ||
needs: check-files | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 # Ensure at least one commit history is fetched | ||
- name: Check if only workflow file has changed | ||
id: file-check | ||
run: | | ||
if git diff --name-only HEAD^ HEAD | grep -v -e '^.github/workflows/update_datasets.yaml$'; then | ||
echo "other-files-changed=true" >> $GITHUB_ENV | ||
else | ||
echo "other-files-changed=false" >> $GITHUB_ENV | ||
fi | ||
- name: Skip workflow if only workflow file has changed | ||
if: env.other-files-changed == 'false' | ||
run: echo "Only workflow file has changed. Reporting success." | ||
- name: Setup Pandoc | ||
if: env.other-files-changed == 'true' | ||
uses: r-lib/actions/setup-pandoc@v2 | ||
- name: Setup R | ||
if: env.other-files-changed == 'true' | ||
uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
- name: Setup R dependencies | ||
if: env.other-files-changed == 'true' | ||
uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
- name: Build site | ||
if: env.other-files-changed == 'true' | ||
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | ||
shell: Rscript {0} | ||
- name: Deploy to GitHub pages 🚀 | ||
if: env.other-files-changed == 'true' && github.event_name != 'pull_request' | ||
uses: JamesIves/github-pages-deploy-action@v4.4.1 | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |