Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace qc scripts with dv.templates ones when running pkgdown #30

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ concurrency:
group: pkgdown-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
TEMPLATE_REF: main
TEMPLATE_REPO: boehringer-ingelheim/dv.templates

jobs:
pkgdown:
name: ${{ vars.CI_IMAGE }}
Expand All @@ -21,6 +25,53 @@ jobs:
- name: Checkout project ⬇️
uses: actions/checkout@v4

- name: Checkout templates repo ⬇️
uses: actions/checkout@v4
with:
ref: ${{env.TEMPLATE_REF}}
repository: ${{env.TEMPLATE_REPO}}
sparse-checkout: |
scripts/
inst/validation
path: templates

- name: Overwrite quality control scripts with dv.templates ones 🧹
shell: bash
run: |
TEMPLATE_DIR="templates/inst/validation"
REPO_DIR="inst/validation"

if test ! -d "${REPO_DIR}"; then
echo "### Quality Control documentation is not present"
echo "### Include quality control documentation or skip it by creating following file 'inst/validation/skip_qc'"
exit 1
fi

if test -f "${REPO_DIR}/skip_qc"; then
echo "skip_qc file found skipping qc documentation"
exit 0
fi

# Conserve specs.R file
cp "${REPO_DIR}/specs.R" "${TEMPLATE_DIR}/specs.R"

set +e # Disable immediate exit in conflicting parts on error for diff command
DIFF_OUTPUT=$(diff -qr "${TEMPLATE_DIR}" "${REPO_DIR}")
set -e # Enable immediate exit on error after diff command

echo "# Quality control files" | tee -a "${GITHUB_STEP_SUMMARY}"

if [ -n "${DIFF_OUTPUT}" ]; then
echo "Warning: The contents of the directories are different!" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "Modified files:" | tee -a "${GITHUB_STEP_SUMMARY}"
echo "$DIFF_OUTPUT" | tee -a "${GITHUB_STEP_SUMMARY}"
else
echo "The directories are identical." | tee -a "${GITHUB_STEP_SUMMARY}"
fi

rm -rf "${REPO_DIR}"
mv "${TEMPLATE_DIR}" "${REPO_DIR}"

- name: Install package dependencies 📄
uses: boehringer-ingelheim/dv.templates/.github/actions/dependencies@main

Expand Down