vitess.io/vitess@v0.16.2/.github/workflows/vtadmin_web_lint.yml (about) 1 name: vtadmin-web linting + formatting 2 3 # In specifying the 'paths' property, we need to include the path to this workflow .yml file. 4 # See https://github.community/t/trigger-a-workflow-on-change-to-the-yml-file-itself/17792/4) 5 on: 6 push: 7 paths: 8 - '.github/workflows/vtadmin_web_lint.yml' 9 - 'web/vtadmin/**' 10 pull_request: 11 paths: 12 - '.github/workflows/vtadmin_web_lint.yml' 13 - 'web/vtadmin/**' 14 15 jobs: 16 lint: 17 runs-on: ubuntu-22.04 18 steps: 19 - name: Skip CI 20 run: | 21 if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then 22 echo "skipping CI due to the 'Skip CI' label" 23 exit 1 24 fi 25 26 - name: Check if workflow needs to be skipped 27 id: skip-workflow 28 run: | 29 skip='false' 30 if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then 31 skip='true' 32 fi 33 echo Skip ${skip} 34 echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT 35 36 - uses: actions/checkout@v3 37 if: steps.skip-workflow.outputs.skip-workflow == 'false' 38 39 - uses: actions/setup-node@v3 40 if: steps.skip-workflow.outputs.skip-workflow == 'false' 41 with: 42 # node-version should match package.json 43 node-version: '16.19.0' 44 45 - name: Install dependencies 46 if: steps.skip-workflow.outputs.skip-workflow == 'false' 47 run: cd ./web/vtadmin && npm ci 48 49 # Using "if: always()" means each step will run, even if a previous 50 # step fails. This is nice because, for example, we want stylelint and 51 # prettier to run even if eslint fails. 52 # 53 # An undesirable secondary effect of this is these steps 54 # will run even if the install, etc. steps fail, which is... weird. 55 # A nice enhancement is to parallelize these steps into jobs, with the 56 # trade-off of more complexity around sharing npm install artifacts. 57 - name: Run eslint 58 if: steps.skip-workflow.outputs.skip-workflow == 'false' && always() 59 run: cd ./web/vtadmin && npm run lint:eslint 60 61 - name: Run stylelint 62 if: steps.skip-workflow.outputs.skip-workflow == 'false' && always() 63 run: cd ./web/vtadmin && npm run lint:stylelint -- -f verbose 64 65 - name: Run prettier 66 if: steps.skip-workflow.outputs.skip-workflow == 'false' && always() 67 run: cd ./web/vtadmin && npm run lint:prettier 68 69 # Cancel pending and in-progress runs of this workflow if a newer ref is pushed to CI. 70 concurrency: 71 group: ${{ github.workflow }}-${{ github.ref }} 72 cancel-in-progress: true