name: Tusk Sanity Check
on:
workflow_dispatch: # Use workflow_dispatch because Tusk will trigger this on its own
inputs:
taskId:
description: "Tusk Task ID"
required: true
runType:
description: "Tusk Run Type"
required: true
runId:
description: "Tusk Run ID"
required: true
jobs:
sanity_check:
runs-on: ubuntu-latest
steps:
- name: Log inputs
run: |
echo "Tusk Task ID: ${{ github.event.inputs.taskId }}"
echo "Tusk Run Type: ${{ github.event.inputs.runType }}"
echo "Tusk Run ID: ${{ github.event.inputs.runId }}"
echo "Current Branch: ${{ github.ref }}"
echo "Repository default branch: ${{ github.event.repository.default_branch }}"
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
# We use paths-filter to determine what directories were modified.
- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.event.repository.default_branch }} # or provide branch name, e.g. 'main'
# Space delimited list usable as command-line argument list in Linux shell. If needed, it uses single or double quotes to wrap filename with unsafe characters.
list-files: "shell"
# Using added|modified so we don't run prettier/eslint on deleted files
filters: |
frontend:
- added|modified: 'frontend/**'
backend:
- added|modified: 'backend/**'
- name: Set Node.js v18.16
uses: actions/setup-node@v3
with:
node-version: 18.16
- name: (Frontend) Install dependencies
if: steps.filter.outputs.frontend == 'true' # You can use the output of paths-filter to decide which steps to run
run: npm ci
working-directory: ./frontend
- name: (Backend) Install dependencies
if: steps.filter.outputs.backend == 'true'
run: npm ci
working-directory: ./backend
- name: (Frontend) Lint fix
if: steps.filter.outputs.frontend == 'true'
run: npm run lint:fix # This lint:fix commands runs prettier and eslint --fix
working-directory: ./frontend
- name: (Backend) Lint fix
if: steps.filter.outputs.backend == 'true'
run: npm run lint:fix # This lint:fix commands runs prettier and eslint --fix
working-directory: ./backend
# You must include this step after running all auto-fixing steps
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "fix(${{ github.run_id }}): auto linting" # The commit message MUST start with "fix(${{ github.run_id }}):"
skip_fetch: true
skip_checkout: true
- name: (Frontend) Check build
if: steps.filter.outputs.frontend == 'true'
run: npm run build:check
working-directory: ./frontend
- name: (Backend) Check build
if: steps.filter.outputs.backend == 'true'
run: npm run build
working-directory: ./backend