-
Notifications
You must be signed in to change notification settings - Fork 13
59 lines (48 loc) · 1.69 KB
/
checks.yml
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
56
57
58
59
# Run some code checks with GitHub Actions.
name: Code checks
on:
push:
branches:
- "main"
pull_request:
permissions:
contents: read
# Allow 1Password/check-signed-commits-action to leave comments on
# pull requests.
pull-requests: write
jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Check out sources
uses: actions/checkout@v3
with:
fetch-depth: 0 # since we need to diff against origin/main.
# https://github.com/marketplace/actions/check-signed-commits-in-pr
- name: Check that commits are signed
uses: 1Password/check-signed-commits-action@v1
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: 'pip' # cache pip dependencies
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black==23.* isort==5.*
- name: Run "black --check"
run: |
python -m black --check .
- name: Run "isort --check"
run: |
python -m isort --profile black --check .
# Remind PR authors to update CHANGELOG.md
- name: Check that Changelog has been updated
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'no changelog')
run: |
# `git diff --exit-code` exits with 1 if there were
# differences and 0 means no differences. Here we negate
# that, because we want to fail if changelog has not been
# updated.
! git diff --exit-code "origin/${GITHUB_BASE_REF}" -- CHANGELOG.md