Skip to content

Migrate CreateLookupVindex and ExternalizeVindex to vtctldclient #2559

Migrate CreateLookupVindex and ExternalizeVindex to vtctldclient

Migrate CreateLookupVindex and ExternalizeVindex to vtctldclient #2559

name: vtadmin-web linting + formatting
# In specifying the 'paths' property, we need to include the path to this workflow .yml file.
# See https://gh.neting.ccmunity/t/trigger-a-workflow-on-change-to-the-yml-file-itself/17792/4)
on:
push:
paths:
- '.github/workflows/vtadmin_web_lint.yml'
- 'web/vtadmin/**'
pull_request:
paths:
- '.github/workflows/vtadmin_web_lint.yml'
- 'web/vtadmin/**'
permissions: read-all
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- name: Skip CI
run: |
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then
echo "skipping CI due to the 'Skip CI' label"
exit 1
fi
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
if: steps.skip-workflow.outputs.skip-workflow == 'false'
- uses: actions/setup-node@v3
if: steps.skip-workflow.outputs.skip-workflow == 'false'
with:
# node-version should match package.json
node-version: '18.16.0'
- name: Install dependencies
if: steps.skip-workflow.outputs.skip-workflow == 'false'
run: cd ./web/vtadmin && npm ci
# Using "if: always()" means each step will run, even if a previous
# step fails. This is nice because, for example, we want stylelint and
# prettier to run even if eslint fails.
#
# An undesirable secondary effect of this is these steps
# will run even if the install, etc. steps fail, which is... weird.
# A nice enhancement is to parallelize these steps into jobs, with the
# trade-off of more complexity around sharing npm install artifacts.
- name: Run eslint
if: steps.skip-workflow.outputs.skip-workflow == 'false' && always()
run: cd ./web/vtadmin && npm run lint:eslint
- name: Run stylelint
if: steps.skip-workflow.outputs.skip-workflow == 'false' && always()
run: cd ./web/vtadmin && npm run lint:stylelint -- -f verbose
- name: Run prettier
if: steps.skip-workflow.outputs.skip-workflow == 'false' && always()
run: cd ./web/vtadmin && npm run lint:prettier
# Cancel pending and in-progress runs of this workflow if a newer ref is pushed to CI.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true