cleanup 1 #868
Workflow file for this run
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
# 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 |