Skip to content

Commit

Permalink
Ensure R is only installed when needed and fix package.json linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Oct 19, 2022
1 parent 47f54a6 commit 4431a7b
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/lint_changed_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ jobs:
# Define the path to a utility for linting package.json files:
lint_package_json="${root}/lib/node_modules/@stdlib/_tools/lint/pkg-json/bin/cli"
files=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep 'package\.json$' | grep -v 'datapackage\.json$')
files=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep 'package\.json$' | grep -v 'datapackage\.json$' | tr '\n' ' ' | sed 's/ $//')
if [ -n "${files}" ]; then
echo "Linting package.json files that have changed..."
echo "${files}" | "${lint_package_json}"
echo "${files}" | "${lint_package_json}" --split=" "
else
echo "No package.json files to lint."
fi
Expand Down Expand Up @@ -196,25 +196,36 @@ jobs:
make lint-python-files FILES="${files}"
fi
# Check for R files:
- name: 'Check for R files'
if: success() || failure()
id: check-r-files
run: |
files=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep -E '\.R$' | tr '\n' ' ' | sed 's/ $//')
if [[ -n "${files}" ]]; then
# Add space-separated list of R files to output:
echo "::set-output name=files::${files}"
else
# Add empty string to output:
echo "::set-output name=files::"
fi
# Setup R:
- name: 'Setup R'
if: success() || failure()
if: ( success() || failure() ) && steps.check-r-files.outputs.files != ''
uses: r-lib/actions/setup-r@v2
with:
r-version: '3.5.3'

# Lint R files:
- name: 'Lint R files'
if: success() || failure()
if: ( success() || failure() ) && steps.check-r-files.outputs.files != ''
run: |
files=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep -E '\.R$' | tr '\n' ' ' | sed 's/ $//')
if [[ -n "${files}" ]]; then
# Install R dependencies:
make install-deps-r
# Install R dependencies:
make install-deps-r
# Lint R files:
make lint-r-files FILES="${files}"
fi
# Lint R files:
make lint-r-files FILES="${{ steps.check-r-files.outputs.files }}"
# Lint C files:
- name: 'Lint C files'
Expand Down

0 comments on commit 4431a7b

Please sign in to comment.