Skip to content

Commit ca977a1

Browse files
committed
fix 3 usage examples. 3 remaining
1 parent 8480832 commit ca977a1

6 files changed

Lines changed: 18 additions & 20 deletions

File tree

integrations/github/src/haystack_integrations/components/connectors/github/file_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class GithubFileEditor:
3636
3737
### Usage example
3838
```python
39-
from haystack.components.actions import GithubFileEditor
39+
from haystack_integrations.components.connectors.github import Command, GithubFileEditor
4040
from haystack.utils import Secret
4141
4242
# Initialize with default repo and branch

integrations/github/src/haystack_integrations/components/connectors/github/issue_commenter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ class GithubIssueCommenter:
1919
2020
### Usage example
2121
```python
22-
from haystack.components.writers import GithubIssueCommenter
22+
from haystack_integrations.components.connectors.github import GithubIssueCommenter
23+
from haystack.utils import Secret
2324
2425
commenter = GithubIssueCommenter(github_token=Secret.from_env_var("GITHUB_TOKEN"))
2526
result = commenter.run(
2627
url="https://github.com/owner/repo/issues/123",
2728
comment="Thanks for reporting this issue! We'll look into it."
2829
)
2930
30-
assert result["success"] is True
31+
print(result["success"])
3132
```
3233
"""
3334

integrations/github/src/haystack_integrations/components/connectors/github/issue_viewer.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ class GithubIssueViewer:
2020
2121
### Usage example
2222
```python
23-
from haystack.components.fetchers import GithubIssueViewer
23+
from haystack_integrations.components.connectors.github import GithubIssueViewer
2424
25-
viewer = GithubIssueViewer(github_token=Secret.from_env_var("GITHUB_TOKEN"))
25+
viewer = GithubIssueViewer()
2626
docs = viewer.run(
2727
url="https://github.com/owner/repo/issues/123"
2828
)["documents"]
2929
30-
assert len(docs) >= 1 # At least the main issue
31-
assert docs[0].meta["type"] == "issue"
30+
print(docs)
3231
```
3332
"""
3433

integrations/github/src/haystack_integrations/components/connectors/github/pr_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class GithubPRCreator:
1717
1818
### Usage example
1919
```python
20-
from haystack.components.actions import GithubPRCreator
20+
from haystack_integrations.components.connectors.github import GithubPRCreator
2121
from haystack.utils import Secret
2222
2323
pr_creator = GithubPRCreator(

integrations/github/src/haystack_integrations/components/connectors/github/repo_viewer.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,25 @@ class GithubRepositoryViewer:
4343
4444
### Usage example
4545
```python
46-
from haystack.components.fetchers import GithubRepositoryViewer
47-
from haystack.utils import Secret
46+
from haystack_integrations.components.connectors.github import GithubRepositoryViewer
4847
49-
# Using token directly
50-
viewer = GithubRepositoryViewer(github_token=Secret.from_token("your_token"))
51-
52-
# Using environment variable
53-
viewer = GithubRepositoryViewer(github_token=Secret.from_env_var("GITHUB_TOKEN"))
48+
viewer = GithubRepositoryViewer()
5449
5550
# List directory contents - returns multiple documents
5651
result = viewer.run(
5752
repo="owner/repository",
5853
path="docs/",
59-
ref="main"
54+
branch="main"
6055
)
56+
print(result)
6157
6258
# Get specific file - returns single document
6359
result = viewer.run(
6460
repo="owner/repository",
6561
path="README.md",
66-
ref="main"
62+
branch="main"
6763
)
64+
print(result)
6865
```
6966
"""
7067

@@ -203,7 +200,7 @@ def run(self, path: str, repo: Optional[str] = None, branch: Optional[str] = Non
203200
204201
:param repo: Repository in format "owner/repo"
205202
:param path: Path within repository (default: root)
206-
:param ref: Git reference (branch, tag, commit) to use
203+
:param branch: Git reference (branch, tag, commit) to use
207204
:return: Dictionary containing list of documents
208205
"""
209206
if repo is None:

integrations/github/src/haystack_integrations/components/connectors/github/repository_forker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ class GithubRepoForker:
1818
1919
### Usage example
2020
```python
21-
from haystack.components.actions import GithubRepoForker
21+
from haystack_integrations.components.connectors.github import GithubRepoForker
2222
from haystack.utils import Secret
2323
2424
# Using direct token with auto-sync and branch creation
2525
forker = GithubRepoForker(
26-
github_token=Secret.from_token("your_token"),
26+
github_token=Secret.from_env_var("GITHUB_TOKEN"),
2727
auto_sync=True,
2828
create_branch=True
2929
)
3030
3131
result = forker.run(url="https://github.com/owner/repo/issues/123")
32+
print(result)
3233
# Will create or sync fork and create branch "fix-123"
3334
```
3435
"""

0 commit comments

Comments
 (0)