Hi all, thanks in advance for any pointers. Does p...
# ask-community
r
Hi all, thanks in advance for any pointers. Does prefect have an API I could hit from Github? Specifically, I want a commit to our github repo to start a new run of a prefect flow. I was able to find Prefect webhooks for doing things after a flow runs, but I am trying to find a way to make a github webhook invoke a prefect flow run, instead. Any pointers?
a
Yes, Prefect has a GraphQL API so you can trigger a flow run using the create_flow_run mutation. But there is an even easier way: you can use the “prefect run” CLI command to start a specific flow run from your CI/CD pipeline. Example using agentless execution of a flow run triggered from CircleCI:
Copy code
version: 2
jobs:
  build:
    docker:
      - image: prefecthq/prefect:latest-python3.9
    steps:
      - checkout  # checkout source code to working directory
      - run: pip install .
      - run: prefect auth login --key $PREFECT_API_KEY
      - run: export PREFECT__CLOUD__USE_LOCAL_SECRETS=false && prefect run --name yourflowname --execute
r
🙏