Skip to content

attempt to fix cookie issue for app maybe??? (#447) #136

attempt to fix cookie issue for app maybe??? (#447)

attempt to fix cookie issue for app maybe??? (#447) #136

name: Autogenerate Alembic Revision
on:
push:
branches:
- main
jobs:
alembic:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: devdb
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d devdb"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/devdb
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: true
- name: Install OS & Python dependencies
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
pip install --upgrade pip
pip install -r requirements.txt
pip install psycopg2-binary
- name: Wait for Postgres to be ready
run: |
until pg_isready -h localhost -p 5432 -U postgres; do
echo "Waiting for Postgres…"
sleep 1
done
- name: Apply existing migrations
run: |
alembic upgrade head
- name: Set up SHORT_SHA
run: echo "SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Generate Alembic revision
id: gen
run: |
alembic revision --autogenerate -m "chore(migration): auto-generated on ${{ github.sha }}"
LATEST=$(ls migrations/versions | tail -n1)
echo "revision_file=${LATEST}" >> $GITHUB_OUTPUT
- name: Check for new migrations
id: check
run: |
CHANGED=$(git status --porcelain migrations/versions)
echo "changed=$CHANGED" >> $GITHUB_ENV
- name: Create or update Pull Request
if: env.changed != ''
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: alembic-migration-${{ env.SHORT_SHA }}
base: main
title: Auto-generated Alembic migration ${{ env.SHORT_SHA }}
body: |
This PR was created automatically by CI.
**Migration file:** `${{ steps.gen.outputs.revision_file }}`
Please review and merge once CI passes.
add-paths: migrations/versions
commit-message: "chore(migration): add autogenerated revision ${{ env.SHORT_SHA }} [skip ci]"