Skip to content

Commit fe75efc

Browse files
authored
fix: add contents:read permission to pypi workflow and fix migration check to use temp DB (#27)
- pypi workflow only had id-token:write; declaring any permissions key drops all others to none, so checkout failed with 'repository not found' on private repos. Added contents:read to restore checkout access. - check_ungenerated_migrations ran alembic check against whatever database DATABASE_URL pointed to. In CI there is no pre-existing database, so alembic reported 'Target database is not up to date' before comparing models to migrations at all. Updated the target to create a fresh temp DB, run upgrade head, then check, then clean up — matching the create_migration pattern.
1 parent 5650bdb commit fe75efc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

{{cookiecutter.__package_slug}}/.github/workflows/pypi.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
pypi:
2020
runs-on: ubuntu-latest
2121
permissions:
22+
contents: read
2223
id-token: write
2324
steps:
2425
- uses: actions/checkout@v6

{{cookiecutter.__package_slug}}/makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ create_migration:
180180

181181
.PHONY: check_ungenerated_migrations
182182
check_ungenerated_migrations:
183-
$(UV) run alembic check
183+
rm -f $(MIGRATION_DATABASE)
184+
DATABASE_URL=sqlite:///$(MIGRATION_DATABASE) $(UV) run alembic upgrade head
185+
DATABASE_URL=sqlite:///$(MIGRATION_DATABASE) $(UV) run alembic check
186+
rm -f $(MIGRATION_DATABASE)
184187

185188
{% endif %}

0 commit comments

Comments
 (0)