-
Notifications
You must be signed in to change notification settings - Fork 21
39 lines (33 loc) · 955 Bytes
/
ci.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
name: CI
# On every pull request, but only on push to main
on:
push:
branches:
- main
pull_request:
jobs:
pr-target-test:
runs-on: ubuntu-latest
steps:
- name: Fail if target is not staging (for PRs only)
if: github.event_name == 'pull_request'
run: |
if [[ "${{ github.event.pull_request.base.ref }}" != "main" || "${{ github.event.pull_request.head.ref }}" == "staging" ]]; then
echo "Target branch is acceptable."
else
echo "Only PRs from staging can target main."
exit 1
fi
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Run pre-commit
run: |
python -m pip install pre-commit
pre-commit run --all-files