Erik Forsman
10/18/2024, 3:35 PMMarvin
10/18/2024, 3:35 PMErik Forsman
10/18/2024, 3:36 PMMarvin
10/18/2024, 3:38 PMGitRepository
feature:
1. Using `from_source`: You should specify your GitHub repository and the entry point for your flow code. Here is a sample of how you can do it:
python
from prefect import flow
from prefect_github import GitHubCredentials
from prefect_github import GitRepository
if __name__ == "__main__":
flow.from_source(
source=GitRepository(
url="<https://github.com/org/private-repo.git>",
credentials=GitHubCredentials.load("my-github-credentials-block"),
branch="your-branch-name" # optional: specify the branch here
),
entrypoint="my_file.py:my_flow" # Specify your flow's entrypoint
).deploy(
name="private-github-deploy",
work_pool_name="my_pool",
build=False
)
2. Using `prefect.yaml`: When creating a deployment, the reference to the GitHub credentials block can be added as shown below:
yaml
pull:
- prefect.deployments.steps.git_clone:
repository: <https://github.com/org/repo.git>
branch: your-branch-name # optional: specify the branch here
credentials: "{{ prefect.blocks.github-credentials.my-github-credentials-block }}"
This allows you to sync your flow code from a specific branch in your GitHub repository. For more detailed instructions, you can refer to the Prefect GitHub Integration documentation.
Let me know if you have further questions!Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by