Hi all, in Prefect Cloud we have two workspaces - ...
# ask-community
b
Hi all, in Prefect Cloud we have two workspaces - dev & prod. When flows are run the code is cloned from the corresponding github branches - develop & main, meaning that we have to maintain a long-running develop branch. There's one more important detail - we're using squash & merge strategy to merge changes from dev to prod and we'd like to change that to merge commit strategy. But here's the issue - we automatically deploy the changed flows to prod workspace in github actions. However in merge strategy we can not do the same as
diff develop...main
command will not show any changes. Could anyone suggest the workaround how to deploy changed flows?
Copy code
---
name: "Deploy modified Flows to Prefect Cloud"

on:
  push:
    branches:
      - develop
      - main

jobs:
  set_description:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.11

  changes:
    name: Summary of flow changes
    runs-on: ubuntu-latest
    outputs:
      prefect_flows: ${{ steps.filter.outputs.flows_files }}
      prefect_flows_changed: ${{ steps.filter.outputs.flows }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - uses: dorny/paths-filter@v2
        id: filter
        with:
          list-files: json
          filters: |
            flows:
              - added|modified: 'flows/**/*.py'
      - name: Generate Markdown Summary
        run: |
          echo Flows: ${{ steps.filter.outputs.flows_files }} >> $GITHUB_STEP_SUMMARY
  deploy:
    needs: changes
    if: ${{ needs.changes.outputs.prefect_flows_changed == 'true' }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        flows: ${{ fromJson(needs.changes.outputs.prefect_flows) }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.11

      - name: Python dependencies
        run: |
          sudo apt-get install -y freetds-dev libkrb5-dev libssl-dev libgssapi-krb5-2
          pip install -U ./docker/default.runner/prefect-ef
          pip install anyio==3.7.1

      - name: Prefect Cloud Dev login
        if: github.ref_name == 'develop'
        run: |
          prefect config set PREFECT_API_KEY=${{ secrets.PREFECT_API_KEY }}
          prefect config set PREFECT_API_URL=${{ secrets.DEV_PREFECT_API_URL }}

      - name: Prefect Cloud Prod login
        if: github.ref_name == 'main'
        run: |
          prefect config set PREFECT_API_KEY=${{ secrets.PREFECT_API_KEY }}
          prefect config set PREFECT_API_URL=${{ secrets.PROD_PREFECT_API_URL }}

      - name: Deploy flows to Prefect Cloud
        id: build
        run: |
          python ${{ matrix.flows }}
FYI @Taylor Curran