Skip to content

cleanup 1

cleanup 1 #868

Workflow file for this run

# Check MRjs has been linted
name: npm run check-format
on:
workflow_dispatch:
push:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
check-format:
runs-on: ubuntu-latest
# needs: build # todo
steps:
- uses: actions/checkout@v4
# todo - run the npm install with a dockerfile setup instead of pure
# install but not important to do right now since install isnt too long
- uses: actions/setup-node@v4
with:
node-version: 18
# todo - are the dependencies needed for lint?
- name: Install Dependencies
run: |
npm install
- name: 👷 Check if format is needed
run: |
# check if either need fixes
npm run prettier-check
exit_code_function_prettier=$?
npm run lint-check
exit_code_function_lint=$?
# check lint first, because it might have changed some prettier items
# if lint is successful, then check against prettier to see if there were
# any remaining problem items
#
# doing this ordering because prettier runs first and then is followed by lint
#
# this is also necessary because part of prettier and lint are in conflict atm
# but it's based on a specific formatting setting, to be resolved.
if [ $exit_code_function_lint -ne 0 ]; then
echo "Function lint encountered an error"
echo "Some files need formatting. Run 'npm run format' to format them or manually fix them as needed."
exit 1
elif [ $exit_code_function_prettier -ne 0 ]; then
echo "Function prettier encountered an error"
echo "Some files need formatting. Run 'npm run format' to format them or manually fix them as needed."
exit 1
fi
if ! npm run check-format; then
echo "Some files need formatting. Run 'npm run format' to format them or manually fix them as needed."
exit 1
fi