SyncM8/syncm8

View on GitHub
.github/workflows/pre-commit.yml

Summary

Maintainability
Test Coverage
name: pre-commit

on:
  pull_request:
  workflow_dispatch:

jobs:
  pre-commit:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Run pre-commit
      run: |
        git fetch origin main ${{ github.event.pull_request.base.sha }}
        bin/infra build
        touch dev.env
        bin/dev client-req
        bin/dev run pipenv run pip install pre-commit
        bin/dev sudo pre-commit run --hook-stage push --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.sha }}
# Our docker-compose.yml expects there to be a dev.env file. Since our testing environment doesn't actually
# need any of the secrets stored there, we can simply create an empty file: `touch dev.env`

# We need to run `bin/dev sudo pre-commit` because of the npm issue outlined in https://github.com/SyncM8/syncm8/pull/126
# This is alleviated in local dev environment by the `Install pre-commit.` step in the `READEME.md`