summaryrefslogtreecommitdiff
path: root/.github/workflows/darker-lint.yml
blob: 974ffa0284152d9a50e11a3cf824b2493a12a32b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
name: Darker-Ruff Lint

on:
  pull_request_target:
    branches:
      - current

permissions:
  pull-requests: write
  contents: read
  
env:
  base_ref: ${{ github.event.pull_request.base.ref }}

jobs:
  darker-lint:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
      contents: read
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          fetch-tags: true
          ref: ${{ github.event.pull_request.head.ref }}
          repository: ${{ github.event.pull_request.head.repo.full_name }}

      - uses: actions/setup-python@v5

      - name: darker install
        run: |
          pip install git+https://github.com/akaihola/darker.git@master ruff>=0.0.292

      # - name: Fetch base branch
      #   run: |
      #     git fetch origin ${base_ref}:refs/remotes/origin/base-current
    
      # - name: Fetch base branch
      #   run: |
      #     git fetch origin ${base_ref}:${base_ref}


      - name: Fetch base and head commits
        run: |
          git fetch https://github.com/${{ github.event.pull_request.base.repo.full_name }} ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/base
          # git fetch origin ${{ github.event.pull_request.base.sha }}:refs/remotes/origin/temp-base
          # git fetch origin ${{ github.event.pull_request.head.sha }}:refs/remotes/origin/temp-head
          # git branch temp-base refs/remotes/origin/temp-base
          # git branch temp-head refs/remotes/origin/temp-head

      - name: Analyze Code
        run: |
          darker -r origin/base --check --diff --lint "ruff check" --color .