MNT Move linting to a dedicated repository #1
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
name: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
strategy: | |
# set fail-fast to false prevent one matrix job from cancelling other matrix jobs | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast | |
fail-fast: false | |
matrix: | |
lint_lang: [ 'lint-md', 'lint-js', 'lint-php' ] | |
name: ${{ matrix.lint_lang }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: Install PHP | |
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2.22.0 | |
with: | |
php-version: 8.1 | |
- name: Install composer dependencies | |
run: composer install --prefer-dist --no-progress --ansi --no-interaction --optimize-autoloader | |
- name: Read .nvmrc | |
if: ${{ matrix.lint_lang == 'lint-md' || matrix.lint_lang == 'lint-js' }} | |
id: read-nvm | |
run: | | |
NPM_VERSION=$(cat vendor/silverstripe/documentation-lint/.nvmrc) | |
echo "version=$NPM_VERSION" >> $GITHUB_OUTPUT | |
- name: Install NPM | |
if: ${{ matrix.lint_lang == 'lint-md' || matrix.lint_lang == 'lint-js' }} | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 | |
with: | |
node-version: ${{ steps.read-nvm.outputs.version }} | |
- name: Install yarn | |
if: ${{ matrix.lint_lang == 'lint-md' || matrix.lint_lang == 'lint-js' }} | |
run: | | |
npm install --global yarn | |
- name: Run lint | |
run: | | |
# Get the correct flag for tha language, e.g. "--md" | |
LINT_LANG=${{ matrix.lint_lang }} | |
FLAG="--${LINT_LANG#lint-}" | |
# Run the script | |
vendor/bin/ss-docs-lint $FLAG |