https://prefect.io logo
#random
Title
# random
a

Apoorva Desai

02/28/2022, 10:09 PM
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

Kevin Kho

02/28/2022, 10:11 PM
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

Anna Geller

02/28/2022, 10:25 PM
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

Apoorva Desai

03/01/2022, 8:56 AM
Thank you!
👍 1
6 Views