Skip to content

Fix releases post monorepo #214

Fix releases post monorepo

Fix releases post monorepo #214

Workflow file for this run

# Autochecks the repo, using formatting and linting commands we run on precommit JUUUUST to be sure
name: Autochecks
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
autocheck:
timeout-minutes: 6
runs-on: ubuntu-latest
strategy:
matrix:
# Each of these are commands we should run and check output
command: ['lint', 'lint:types', 'format']
outputs:
lint: ${{ steps.changes.outputs.lint }}
linttypes: ${{ steps.changes.outputs.linttypes }}
format: ${{ steps.changes.outputs.format }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
run_install: false
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install
- name: ${{ matrix.command }}
run: NODE_OPTIONS=--max_old_space_size=8192 pnpm turbo ${{ matrix.command }}
- name: Output changed files
id: changes
# Removes both leading/trailing whitespace after getting diffed files and removing package.json/pnpm.lock
run: |
CHANGED="$(git diff --name-only --diff-filter=ACMRT | xargs | sed 's/package.json//g;s/pnpm.lock//g;s/^[ \t]*//g;s/[ \t]*$//g')"
COMMAND_NAME="${{ matrix.command }}"
OUTPUTNAME="${COMMAND_NAME//:/}"
echo "Changed files were: $CHANGED"
echo "$OUTPUTNAME=$CHANGED" >> $GITHUB_OUTPUT
# If anything is output, fails this job!
fail-on-diff:
timeout-minutes: 5
runs-on: ubuntu-latest
needs: autocheck
if: ${{ needs.autocheck.outputs.lint || needs.autocheck.outputs.linttypes || needs.autocheck.outputs.format }}
steps:
- name: Exiting because of changed files
run: |
echo "Changed from lint: ${{needs.autocheck.outputs.lint || 'none'}}"
echo "Type check changed files: ${{needs.autocheck.outputs.linttypes || 'none'}}"
echo "Files formatted: ${{needs.autocheck.outputs.format || 'none'}}"
exit 1