Skip to content

Commit

Permalink
don't use branch on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech committed Mar 29, 2024
1 parent 7ffb53e commit 8209f27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
if: needs.changes.outputs.backend == 'true'
timeout-minutes: 10

name: Validate Django migrations
name: Validate Django and CH migrations
runs-on: depot-ubuntu-latest-4

steps:
Expand Down Expand Up @@ -231,6 +231,9 @@ jobs:
# initial migrations (0001_*) as these are guaranteed to be
# run on initial setup where there is no data.
git diff --name-status origin/master..HEAD | grep "A\sposthog/migrations/" | awk '{print $2}' | grep -v migrations/0001_ | python manage.py test_migrations_are_safe
- name: Check CH migrations
run: |
# Same as above, except now for CH looking at files that were added in posthog/clickhouse/migrations/
git diff --name-status origin/master..HEAD | grep "A\sposthog/clickhouse/migrations/" | awk '{print $2}' | python manage.py test_ch_migrations_are_safe
Expand Down
4 changes: 2 additions & 2 deletions posthog/management/commands/test_ch_migrations_are_safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logger = logging.getLogger(__name__)
repo_path = os.getcwd()
repo = Repo(repo_path)
current_branch = repo.active_branch.name
current_sha = repo.head.object.hexsha


class Command(BaseCommand):
Expand All @@ -22,7 +22,7 @@ def run_and_check_migration(new_migration):
repo.git.checkout("master")
old_migration_files = os.listdir("posthog/clickhouse/migrations")
old_migrations = []
repo.git.checkout(current_branch)
repo.git.checkout(current_sha)

for migration in old_migration_files:
match = re.findall(r"([0-9]+)_([a-zA-Z_0-9]+)\.py", migration)
Expand Down

0 comments on commit 8209f27

Please sign in to comment.