# GITHUB ACTION

Add this code in your `.github/workflows/codefather.yml` (the file name is up to you). The `GITHUB_TOKEN` will be automatically injected by Github.

```yml
name: Codefather Validation
on:
  pull_request:
    branches: [main]

permissions:
  contents: read
  pull-requests: write

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Install dependencies
        run: npm install

      - name: Run Codefather
        run: npx codefather-github
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

### 🛡️ ENFORCE REVIEWS

To enforce reviews from codeowners (goodfellas, caporegimes and crews), consider enabling branch protection in your repository settings. To do it:

* Go to `settings`
* Click on `Branches` on the left sidebar
* Select `Add classic branch protection rule`
* Check
  * `Require a pull request before merging`
  * `Require approvals`
  * `Require review from Code Owners`
  * `Require status checks to pass before merging`
* ✅ You're now under the protection of the Codefather.
