File: clean_pr.yml

package info (click to toggle)
matplotlib 3.10.7%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 72,820 kB
  • sloc: python: 147,545; cpp: 62,988; objc: 1,679; ansic: 1,426; javascript: 788; makefile: 92; sh: 53
file content (54 lines) | stat: -rw-r--r-- 2,182 bytes parent folder | download
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
---
name: PR cleanliness
on: [pull_request]

permissions:
  contents: read

jobs:
  pr_clean:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2
        with:
          fetch-depth: '0'
          persist-credentials: false
      - name: Check for added-and-deleted files
        run: |
          git fetch --quiet origin "$GITHUB_BASE_REF"
          base="$(git merge-base "origin/$GITHUB_BASE_REF" 'HEAD^2')"
          ad="$(git log "$base..HEAD^2" --pretty=tformat: --name-status --diff-filter=AD |
                cut --fields 2 | sort | uniq --repeated)"
          if [[ -n "$ad" ]]; then
            printf 'The following files were both added and deleted in this PR:\n%s\n' "$ad"
            exit 1
          fi
      - name: Check for added-and-modified images
        run: |
          git fetch --quiet origin "$GITHUB_BASE_REF"
          base="$(git merge-base "origin/$GITHUB_BASE_REF" 'HEAD^2')"
          am="$(git log "$base..HEAD^2" --pretty=tformat: --name-status --diff-filter=AM |
                cut --fields 2 | sort | uniq --repeated |
                grep -E '\.(png|pdf|ps|eps|svg)' || true)"
          if [[ -n "$am" ]]; then
            printf 'The following images were both added and modified in this PR:\n%s\n' "$am"
            exit 1
          fi
      - name: Check for invalid backports to -doc branches
        if: endsWith(github.base_ref, '-doc')
        run: |
          git fetch --quiet origin "$GITHUB_BASE_REF"
          base="$(git merge-base "origin/$GITHUB_BASE_REF" 'HEAD^2')"
          lib="$(git log "$base..HEAD^2" --pretty=tformat: --name-status -- lib src |
                 cut --fields 2 | sort || true)"
          if [[ -n "$lib" ]]; then
            printf 'Changes to the following files have no effect and should not be backported:\n%s\n' "$lib"
            exit 1
          fi
      - name: Check for branches opened against main
        if: github.ref_name == 'main'
        run: |
          echo 'PR branch should not be main.'
          echo 'See https://matplotlib.org/devdocs/devel/development_workflow.html#make-a-new-feature-branch'
          exit 1