Skip to content

Commit cd14187

Browse files
committed
ci: Add check for missing migration in pre_commit.sh and actions
1 parent 65d56a9 commit cd14187

File tree

5 files changed

+67
-1
lines changed

5 files changed

+67
-1
lines changed

.github/workflows/test_and_publish.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,26 @@ jobs:
118118
run: |
119119
bandit --ini=setup.cfg -ll 2> /dev/null
120120
121+
migrations:
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v4
125+
126+
- name: Setup Python
127+
uses: actions/setup-python@master
128+
with:
129+
python-version: '3.13'
130+
131+
- name: Install packages
132+
run: |
133+
pip install -r requirements_dev.txt
134+
pip install -r requirements.txt
135+
136+
- name: Check for Missing Migrations
137+
run: |
138+
python3 manage.py makemigrations --check --dry-run --no-input
139+
140+
121141
122142
test:
123143
needs: [black, isort, pycodestyle, pydocstyle, bandit]

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
### 1.0.3 - 2025-09-23
5+
6+
* Add missing migration `0002_alter_session_status`.
7+
* Add check for missing migrations in `bin/pre_commit.sh` and GitHub actions.
8+
49
### 1.0.2 - 2025-09-22
510

611
* Uses pyproject.toml to publish the package

bin/pre_commit.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,20 @@ fi
8585
echo ""
8686

8787

88+
################################################################################
89+
# MIGRATIONS #
90+
################################################################################
91+
echo -n "${Cyan}Checking for missing migrations... $Color_Off"
92+
out=$(python3 manage.py makemigrations --check --dry-run --no-input &> /dev/null)
93+
if [ "$?" -ne 0 ] ; then
94+
echo "${Red}migrations are missing !$Color_Off"
95+
echo "${Red}Run 'python3 manage.py makemigrations' before committing !$Color_Off"
96+
EXIT_CODE=1
97+
else
98+
echo "${Green}Ok ✅ $Color_Off"
99+
fi
100+
echo ""
101+
88102

89103
################################################################################
90104

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "drf-simple-oauth2"
7-
version = "1.0.2"
7+
version = "1.0.3"
88
description = "Simple OAuth2 client package allowing to define OAuth2 / OpenID providers through settings."
99
readme = "README.md"
1010
requires-python = ">=3.10"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Generated by Django 4.1.13 on 2025-09-23 02:44
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("simple_oauth2", "0001_initial"),
9+
]
10+
11+
operations = [
12+
migrations.AlterField(
13+
model_name="session",
14+
name="status",
15+
field=models.CharField(
16+
choices=[
17+
("pending", "Pending"),
18+
("token_failed", "Token Failed"),
19+
("userinfo_failed", "Userinfo Failed"),
20+
("expired", "Expired"),
21+
("completed", "Completed"),
22+
],
23+
default="pending",
24+
max_length=20,
25+
),
26+
),
27+
]

0 commit comments

Comments
 (0)