Skip to content
on:
workflow_call:
inputs:
skip:
required: false
type: string
default: ''
main_branches:
required: false
type: string
default: 'main,master'
event_name:
required: true
type: string
run_id:
required: true
type: string
rcmdcheck_args:
required: false
type: string
default: 'c("--no-manual", "--as-cran", "--no-tests")'
schemas:
required: false
type: string
backend_exclude:
required: false
type: string
check_postgres_logs:
required: false
type: boolean
default: true
auto_link_r6:
required: false
type: boolean
default: true
jobs:
# To give granular control of when workflows should execute, we determine which "categories" of files has changed
trigger:
name: ⚙️ Determine downstream workflow triggers
runs-on: ubuntu-latest
outputs:
on_main_branch: ${{ steps.main_branch_affected.outputs.on_main_branch }}
main_branch_affected: ${{ steps.main_branch_affected.outputs.main_branch_affected }}
branch_name: ${{ steps.branch_name.outputs.branch_name }}
cache_version: ${{ steps.cache_version.outputs.cache_version }}
min_r_version: ${{ steps.min_r_version.outputs.min_R_version }}
lint: ${{
!contains(inputs.skip, 'lint') &&
(
inputs.event_name == 'workflow_dispatch' ||
steps.main_branch_affected.outputs.on_main_branch == 'true' ||
(
steps.changed-files-yaml.outputs.R_any_changed == 'true' ||
steps.changed-files-yaml.outputs.test_any_changed == 'true' ||
steps.changed-files-yaml.outputs.man_any_changed == 'true' ||
steps.changed-files-yaml.outputs.vignette_any_changed == 'true' ||
steps.changed-files-yaml.outputs.lintr_any_changed == 'true'
)
) }}
spell-checker: ${{
!contains(inputs.skip, 'spell-checker') &&
(
inputs.event_name == 'workflow_dispatch' ||
steps.main_branch_affected.outputs.on_main_branch == 'true' ||
(
steps.changed-files-yaml.outputs.description_any_changed == 'true' ||
steps.changed-files-yaml.outputs.man_any_changed == 'true' ||
steps.changed-files-yaml.outputs.vignette_any_changed == 'true'
)
) }}
R-CMD-check: ${{
!contains(inputs.skip, 'R-CMD-check') &&
(
inputs.event_name == 'workflow_dispatch' ||
inputs.event_name == 'release' ||
steps.main_branch_affected.outputs.on_main_branch == 'true' ||
(
steps.main_branch_affected.outputs.main_branch_affected == 'true' &&
(
steps.changed-files-yaml.outputs.R_any_changed == 'true' ||
steps.changed-files-yaml.outputs.test_any_changed == 'true' ||
steps.changed-files-yaml.outputs.description_any_changed == 'true' ||
steps.changed-files-yaml.outputs.man_any_changed == 'true' ||
steps.changed-files-yaml.outputs.vignette_any_changed == 'true'
)
)
) }}
code-coverage: ${{
!contains(inputs.skip, 'code-coverage') &&
(
inputs.event_name == 'workflow_dispatch' ||
inputs.event_name == 'release' ||
steps.main_branch_affected.outputs.on_main_branch == 'true' ||
(
steps.main_branch_affected.outputs.main_branch_affected == 'true' &&
(
steps.changed-files-yaml.outputs.R_any_changed == 'true' ||
steps.changed-files-yaml.outputs.test_any_changed == 'true' ||
steps.changed-files-yaml.outputs.description_any_changed == 'true'
)
)
) }}
styler: ${{
!contains(inputs.skip, 'styler') &&
( inputs.event_name == 'workflow_dispatch' || inputs.event_name != 'release' )
) }}
document: ${{
!contains(inputs.skip, 'document') &&
(
inputs.event_name == 'workflow_dispatch' ||
(
inputs.event_name != 'release' &&
(
steps.main_branch_affected.outputs.on_main_branch == 'true' ||
steps.changed-files-yaml.outputs.R_any_changed == 'true' ||
steps.changed-files-yaml.outputs.description_any_changed == 'true'
)
)
) }}
render-readme: ${{
!contains(inputs.skip, 'render-readme') &&
(
inputs.event_name == 'workflow_dispatch' ||
(
inputs.event_name != 'release' &&
(
steps.main_branch_affected.outputs.main_branch_affected == 'true' ||
needs.trigger.outputs.readme_any_changed == 'true'
)
)
) }}
pkgdown: ${{
!contains(inputs.skip, 'pkgdown') &&
(
inputs.event_name == 'workflow_dispatch' ||
inputs.event_name == 'release' ||
steps.main_branch_affected.outputs.on_main_branch == 'true' ||
(
steps.main_branch_affected.outputs.main_branch_affected == 'true' &&
(
steps.changed-files-yaml.outputs.R_any_changed == 'true' ||
steps.changed-files-yaml.outputs.description_any_changed == 'true' ||
steps.changed-files-yaml.outputs.man_any_changed == 'true' ||
steps.changed-files-yaml.outputs.vignette_any_changed == 'true'
)
)
) }}
update-lockfile: ${{
!contains(inputs.skip, 'update-lockfile') &&
(
inputs.event_name == 'workflow_dispatch' ||
(
inputs.event_name != 'release' &&
(
steps.main_branch_affected.outputs.on_main_branch == 'true' ||
(
steps.main_branch_affected.outputs.main_branch_affected == 'true' &&
(
steps.changed-files-yaml.outputs.R_any_changed == 'true' ||
steps.changed-files-yaml.outputs.test_any_changed == 'true' ||
steps.changed-files-yaml.outputs.description_any_changed == 'true'
)
)
)
)
) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect changes to R/, tests/, man/, vignettes/, README.Rmd and DESCRIPTION
id: changed-files-yaml
uses: tj-actions/changed-files@v41
with:
files_yaml: |
R:
- R/**
- data-raw/**
test:
- tests/**
man:
- man/**
vignette:
- vignettes/**
readme:
- README.md
- README.Rmd
- .github/templates/README_template.Rmd
description:
- DESCRIPTION
lintr:
- .lintr*
- name: Determine branch name
id: branch_name
shell: bash
run: |
echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Determine main branch involvement
id: main_branch_affected
shell: bash
run: |
if [ "${{ inputs.event_name }}" == "pull_request" ] && [[ "${{ inputs.main_branches }}" == *"$GITHUB_BASE_REF"* ]]; then
# Pull request event to a main branch
echo "main_branch_affected=true" >> $GITHUB_OUTPUT
echo "on_main_branch=false" >> $GITHUB_OUTPUT
elif [ "${{ inputs.event_name }}" != "pull_request" ] && [[ "${{ inputs.main_branches }}" == *"$GITHUB_REF_NAME"* ]]; then
# Non pull request event to a main branch
echo "main_branch_affected=true" >> $GITHUB_OUTPUT
echo "on_main_branch=true" >> $GITHUB_OUTPUT
else
# All other cases
echo "main_branch_affected=false" >> $GITHUB_OUTPUT
echo "on_main_branch=false" >> $GITHUB_OUTPUT
fi
- name: Determine R version requirement in DESCRIPTION
id: min_r_version
run: |
min_R_version=$(awk '/R \(>= / {match($0, /R \(>= ([0-9]+\.[0-9]+(\.[0-9]+)?)/, arr); print arr[1]}' DESCRIPTION)
echo "min_R_version=${min_R_version}" >> $GITHUB_OUTPUT
- name: Invalidate cache on workflow_dispatch
id: cache_version
shell: bash
run: |
if [ "${{ inputs.event_name }}" == "workflow_dispatch" ] ; then
echo "cache_version=0" >> $GITHUB_OUTPUT
else
echo "cache_version=1" >> $GITHUB_OUTPUT
fi
- name: Report triggers
run: |
echo "R/ directory changes: ${{ steps.changed-files-yaml.outputs.R_any_changed }}"
echo "tests/ directory changes: ${{ steps.changed-files-yaml.outputs.test_any_changed }}"
echo "man/ directory changes: ${{ steps.changed-files-yaml.outputs.man_any_changed }}"
echo "vignettes/ directory changes: ${{ steps.changed-files-yaml.outputs.vignette_any_changed }}"
echo "README.Rmd changed: ${{ steps.changed-files-yaml.outputs.readme_any_changed }}"
echo "DESCRIPTION changed: ${{ steps.changed-files-yaml.outputs.description_any_changed }}"
echo "lintr files changed: ${{ steps.changed-files-yaml.outputs.lintr_any_changed }}"
echo "main branch affected: ${{ steps.main_branch_affected.outputs.main_branch_affected }}"
echo "branch name: ${{ steps.branch_name.outputs.branch_name }}"
echo "cache_version: ${{ steps.cache_version.outputs.cache_version }}"
echo "R version requirement: ${{ steps.min_r_version.outputs.min_R_version }}"
inspect-trigger-output:
needs: trigger
name: 🐞 Inspect trigger output
runs-on: ubuntu-latest
steps:
- run: |
echo "main_branch_affected: ${{ needs.trigger.outputs.main_branch_affected }}"
echo "branch_name: ${{ needs.trigger.outputs.branch_name }}"
echo "cache_version: ${{ needs.trigger.outputs.cache_version }}"
echo "min_r_version: ${{ needs.trigger.outputs.min_r_version }}"
echo "lint: ${{ needs.trigger.outputs.lint }}"
echo "spell-checker: ${{ needs.trigger.outputs.spell-checker }}"
echo "R-CMD-check: ${{ needs.trigger.outputs.R-CMD-check }}"
echo "code-coverage: ${{ needs.trigger.outputs.code-coverage }}"
echo "styler: ${{ needs.trigger.outputs.styler }}"
echo "document: ${{ needs.trigger.outputs.document }}"
echo "render-readme: ${{ needs.trigger.outputs.render-readme }}"
echo "pkgdown: ${{ needs.trigger.outputs.pkgdown }}"
echo "update-lockfile: ${{ needs.trigger.outputs.update-lockfile }}"
update-lockfile:
needs: trigger
uses: ./.github/workflows/update-lockfile.yaml
if: ${{ needs.trigger.outputs.update-lockfile == 'true' }}
with:
cache_version: ${{ needs.trigger.outputs.cache_version }}
branch_name: ${{ needs.trigger.outputs.branch_name }}
secrets: inherit
concurrency:
group: update-lockfile-${{ needs.trigger.outputs.branch_name }}
cancel-in-progress: true

Check failure on line 300 in .github/workflows/workflow-dispatcher.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/workflow-dispatcher.yaml

Invalid workflow file

You have an error in your yaml syntax on line 300
document-render-readme-styler:
needs: [trigger, update-lockfile]
uses: ./.github/workflows/document-render-readme-styler.yaml
if: ${{ always() && !failure() && !cancelled() }}
with:
branch_name: ${{ needs.trigger.outputs.branch_name }}
cache_version: ${{ needs.trigger.outputs.cache_version }}
styler: ${{ needs.trigger.outputs.styler == 'true' }}
document: ${{ needs.trigger.outputs.document == 'true' }}
render_readme: ${{ needs.trigger.outputs.render-readme == 'true' }}
secrets: inherit
concurrency:
group: document-render-readme-styler-${{ needs.trigger.outputs.branch_name }}
cancel-in-progress: true
lint:
needs: [trigger, update-lockfile, document, render-readme]
if: ${{ always() && !failure() && !cancelled() && needs.trigger.outputs.lint == 'true' }}
uses: ./.github/workflows/lint.yaml
with:
cache_version: ${{ needs.trigger.outputs.cache_version }}
spell-checker:
needs: [trigger, update-lockfile, document, render-readme]
if: ${{ always() && !failure() && !cancelled() && needs.trigger.outputs.spell-checker == 'true' }}
uses: ./.github/workflows/spell-checker.yaml
secrets: inherit
R-CMD-check:
needs: [trigger, update-lockfile, document, render-readme]
if: ${{ always() && !failure() && !cancelled() && needs.trigger.outputs.R-CMD-check == 'true' }}
uses: ./.github/workflows/R-CMD-check.yaml
with:
rcmdcheck_args: ${{ inputs.rcmdcheck_args }}
cache_version: ${{ needs.trigger.outputs.cache_version }}
min_r_version: ${{ needs.trigger.outputs.min_r_version }}
secrets: inherit
concurrency:
group: R-CMD-check-${{ needs.trigger.outputs.branch_name }}
cancel-in-progress: true
code-coverage:
needs: [trigger, update-lockfile, document, render-readme]
if: ${{ always() && !failure() && !cancelled() && needs.trigger.outputs.code-coverage == 'true' }}
uses: ./.github/workflows/code-coverage.yaml
with:
cache_version: ${{ needs.trigger.outputs.cache_version }}
schemas: ${{ inputs.schemas }}
backend_exclude: ${{ inputs.backend_exclude }}
check_postgres_logs: ${{ inputs.check_postgres_logs }}
secrets: inherit
concurrency:
group: code-coverage-${{ needs.trigger.outputs.branch_name }}
cancel-in-progress: true
pkgdown:
needs: [trigger, update-lockfile, document, render-readme]
if: ${{ always() && !failure() && !cancelled() && needs.trigger.outputs.pkgdown == 'true' }}
uses: ./.github/workflows/pkgdown.yaml
with:
auto_link_r6: ${{ inputs.auto_link_r6 }}
event_name: ${{ inputs.event_name }}
main_branches: ${{ inputs.main_branches }}
run_id: ${{ inputs.run_id }}
cache_version: ${{ needs.trigger.outputs.cache_version }}
secrets: inherit
concurrency:
group: pkgdown-${{ needs.trigger.outputs.branch_name }}${{ github.event_name == 'release' && '-release' || '' }}
cancel-in-progress: true