Hello, I am trying to run a prefect flow triggered...
# random
a
Hello, I am trying to run a prefect flow triggered by when there is a change in a github repository that is NOT the repo that the prefect flow lives in. TLDR: pull request on repository A triggers prefect flow living in Repository B. This is the closest I've come to figuring this out: https://docs.prefect.io/core/pins/pin-08-listener-flows.html Has anyone done this before or have instructions?
k
Hi @Apoorva Desai, our paradigm around this is triggering the Flow like this. You can hit the Prefect API with
Client.create_flow_run
or the
create_flow_run
task
Or you can even use a Python request
a
could you explain the problem that you try to solve a bit more? if you would like to just execute code from another repository, you could use pygit2:
Copy code
@task(name="Clone DBT repo")
def pull_dbt_repo(repo_url: str, branch: str = None):
    pygit2.clone_repository(url=repo_url, path=DBT_PROJECT, checkout_branch=branch)
but if you are trying to build a CI/CD pipeline, you would usually register a flow on merge to e.g. master branch rather than triggering a flow
a
Thank you!
👍 1