name: Just Check

on:
  push:
    branches: [main]
  pull_request:

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: astral-sh/setup-uv@v4

      - uses: extractions/setup-just@v2

      - name: Job summary
        run: |
          echo "## 🐤 Dippy CI" >> $GITHUB_STEP_SUMMARY
          echo "" >> $GITHUB_STEP_SUMMARY
          echo "| Parameter | Value |" >> $GITHUB_STEP_SUMMARY
          echo "|-----------|-------|" >> $GITHUB_STEP_SUMMARY
          echo "| **Trigger** | ![](https://img.shields.io/badge/${{ github.event_name }}-blue?style=flat-square&logo=githubactions) |" >> $GITHUB_STEP_SUMMARY
          echo "| **Triggered by** | ${{ github.actor }} |" >> $GITHUB_STEP_SUMMARY
          echo "| **Commit** | \`${{ github.sha }}\` |" >> $GITHUB_STEP_SUMMARY
          echo "| **Branch** | \`${{ github.ref_name }}\` |" >> $GITHUB_STEP_SUMMARY

      - name: Run checks
        run: just check

      - name: Upload logs
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: logs
          path: |
            /tmp/dippy-test-py3.11.log
            /tmp/dippy-test-py3.12.log
            /tmp/dippy-test-py3.13.log
            /tmp/dippy-test-py3.14.log
            /tmp/dippy-lint.log
            /tmp/dippy-fmt.log
            /tmp/dippy-lock.log
