Automatically Merge Branch that doesn’t contain the config file

I am using Flutterflow, a low code tool for designing Flutter projects. It can push code into a flutterflow branch in Github. Anytime that the flutterflow branch is updated, I want to merge into a develop branch.

One of the constraints is that you cannot make changes to the flutterflow branch - any changes made will get overwritten the next time Flutterflow pushes its changes. So I can’t host the config.yml file in that branch.

I am getting an error “Failed to fetch config.yml file.” and I think it is because Circle Ci is looking in to the flutterflow branch for the config file.

Does anyone know how to set this up to run on pushes into the flutterflow branch?

This is my config file:

version: 2.1

# Define a job to be invoked later in a workflow.
jobs:
  merge_flutterflow_to_develop:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - run:
          name: Configure Git User
          command: |
            git config --global user.email "ci@getsylvester.com"
            git config --global user.name "Sylvester CI Bot"
      - run:
          name: Merge Changes from flutterflow to develop
          command: |
            git checkout develop
            git merge origin/flutterflow
            git push origin develop

workflows:
  version: 2
  on_push_to_flutterflow:
    jobs:
      - merge_flutterflow_to_develop:
          filters:
            branches:
              only: flutterflow

(PS sorry for the double post, couldn’t figure out how to edit)

You can set it so that only certain branches are run by filtering workflows by branch:

I think you have misunderstood dansomrack’s problem.

Flutterflow has a very strange integration with git repos - basically none in the normal sense. When using the Flutterflow git integration it basically regenerates the flutterflow branch in the repo from the app expressed in the Flutterflow design tool. The logic is that the newly recreated branch can then be merged into any other branch of the repo.

The complication is that Flutterflow does not seem to allow any external files/artifacts to be included when the flutterflow branch is recreated and so a config.yml file can not be included for when the github/CircleCI webhook integration fires.

The config.yml provided by dansomrack is trying to automate the process of merging the created flutterflow branch into the develop branch, otherwise, this has to be done as a manual step every time.

From my understanding of the CircleCI platform, there is no simple solution as there does not seem to be any way of having a config.yml used from outside of the repo branch being processed. I did not reply to dansomrack’s original post as the only answer I could come up with was an overly complex solution that involved a github webhook firing some form of independent service that in turn made a CircleCI API call that started a workflow on a repo branch that could correctly host the config.yml file.

1 Like

Thanks @rit1010 for the context on Flutterflow.

@dansomrack I want to make sure I’m following you, so I’m going to step this out:

  1. Changes are made to flutterflow branch
  2. You want to merge those changes into a develop branch for testing
  3. Rinse. Repeat.

Assuming that is correct, I’m thinking of a flow that would work here:

  1. Set your project settings to only build on PRs (CircleCI App > Project settings > Advanced)
  2. Use a GitHub Action to auto-create a PR when Flutterflow pushes a change
  3. Kick off a build on the PR

You could also probably use an action to auto-merge without a PR but probably not recommended.

Let me know your thoughts and if you want to pair up and review.

Sorry for the delayed response.

Thank you both for your replies. @rit1010 , what you described is the exact scenario. We were also thinking about an approach using webhooks from GitHub, but at that point might leave CircleCI out completely for this branch.

@jerdog Yes, changes are made to the flutterflow branch every time there is a push from Flutterflow UI. Flutterflow UI is acting like a glorified one-way IDE. We have a few commits in the develop branch for functionality not available through Flutterflow UI, such as adding in Sentry Web. We want to be able to use the develop branch deployed to a test environment as our internal testing grounds.

I’ll try the steps you recommended and dig into using PR builds for this.

Thanks!
Dan