Merge pull request #236 from snezhig/dev #522
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Node.js CI | |
on: | |
push: | |
branches: ["**"] | |
pull_request: | |
branches: ["**"] | |
jobs: | |
validate: | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "npm" | |
- run: npm i | |
- name: Eslint | |
run: npm run eslint | |
- name: Run test | |
run: npm run test | |
pretty: | |
needs: validate | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'snezhig/obsidian-front-matter-title' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# Make sure the actual branch is checked out when running on pull requests | |
ref: ${{ github.head_ref }} | |
- name: Prettify code | |
uses: creyD/[email protected] | |
with: | |
prettier_version: 2.8.8 | |
# This part is also where you can pass other options, for example: | |
prettier_options: --write *.ts *.json src test --ignore-path package-lock.json |