Getting started
Prerequisites
Install prefect-github
The following command will install a version of prefect-github
compatible with your installed version of prefect
.
If you don’t already have prefect
installed, it will install the newest version of prefect
as well.
prefect
and prefect-github
:
Register newly installed block types
Register the block types in theprefect-github
module to make them available for use.
Examples
In the examples below, you create blocks with Python code. Alternatively, blocks can be created through the Prefect UI. To create a deployment and run a deployment where the flow code is stored in a private GitHub repository, you can use theGitHubCredentials
block.
A deployment can use flow code stored in a GitHub repository without using this library in either of the following cases:
- The repository is public
- The deployment uses a Secret block to store the token
Access flow code stored in a private GitHub repository in a deployment
Use the credentials block you created above to pass the GitHub access token during deployment creation. The code below assumes there’s flow code stored in a private GitHub repository.prefect.yaml
file to create the deployment, reference the GitHub Credentials block in the pull
step:
Interact with a GitHub repository
You can use prefect-github to create and retrieve issues and PRs from a repository. Here’s an example of adding a star to a GitHub repository:Resources
For assistance using GitHub, consult the GitHub documentation. Refer to theprefect-github
SDK documentation to explore all the capabilities of the prefect-github
library.