PrefectHQ / prefect

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.
https://prefect.io
Apache License 2.0
15.83k stars 1.55k forks source link

GitHub block does not support fine-grained PATs #8583

Closed EmilRex closed 1 year ago

EmilRex commented 1 year ago

First check

Bug summary

The GitHub storage block does not work with GitHub's new fine grained access tokens. Using a fine-grained token results in password prompt with the example below. More details in this SO post.

Reproduction

from prefect.filesystems import GitHub

GITHUB_TOKEN = "<PAT GOES HERE>"

block = GitHub(
    repository="https://github.com/<owner>/<repo>.git",
    reference="main",
    access_token=GITHUB_TOKEN
)

block.get_directory(local_path="./gh_pat_test")

Error

Password for 'https://<PAT GOES HERE>@github.com':

Versions

Version:             2.8.2
API version:         0.8.4
Python version:      3.9.16
Git commit:          afbed19d
Built:               Fri, Feb 17, 2023 10:02 AM
OS/Arch:             darwin/arm64
Profile:             default
Server type:         cloud

Additional context

No response

serinamarie commented 1 year ago

It sounds reasonable to me to support the new fine-grained PATs if possible 👍

discdiver commented 1 year ago

Closing as fine-grained PAT format is now shown in the UI with #8929 and confirmed with @zzstoatzz that it works.