Ishan Anilbhai Koradiya
10/31/2024, 10:40 AMMarvin
10/31/2024, 10:41 AMIshan Anilbhai Koradiya
10/31/2024, 10:42 AM2.18.3
@MarvinMarvin
10/31/2024, 10:42 AMprefect-github
to pull code from a GitHub repository, the code is pulled to the local environment where the Prefect agent is running. The agent then executes the flow using this local copy of the repository.
To set this up, you need to use the GitHubCredentials
block to authenticate and pull code. Here's a brief overview of how you can set it up:
1. Install the Prefect GitHub integration:
pip install prefect-github
2. Register the block types:
prefect block register -m prefect_github
3. Create a GitHubCredentials
block:
python
from prefect_github import GitHubCredentials
github_credentials_block = GitHubCredentials(token="YOUR_TOKEN")
github_credentials_block.save(name="my-github-credentials-block")
4. Set repository details in your deployment to pull code:
yaml
pull:
- prefect.deployments.steps.git_clone:
repository: <https://github.com/org/my-private-repo.git>
credentials: "{{ prefect.blocks.github-credentials.my-block-name }}"
For more detailed steps, you can refer to the Prefect GitHub Integration Documentation.