Skip to content

Commit

Permalink
馃悰Source GitHub: added description for no repos case error (#26075)
Browse files Browse the repository at this point in the history
* added description for no repos case error

* added AirbyteTracedException

* added changelog

* removed handling error in validation

* updated github.md

* added unit test test_streams_no_streams_available_error

* auto-bump connector version

---------

Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
  • Loading branch information
darynaishchenko and octavia-squidington-iii committed May 16, 2023
1 parent 1cbd925 commit 0599080
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13563,7 +13563,7 @@
"sourceDefinitionId": "ef69ef6e-aa7f-4af1-a01d-ef775033524e",
"name": "GitHub",
"dockerRepository": "airbyte/source-github",
"dockerImageTag": "0.4.9",
"dockerImageTag": "0.4.10",
"documentationUrl": "https://docs.airbyte.com/integrations/sources/github",
"icon": "github.svg",
"sourceType": "api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@
- name: GitHub
sourceDefinitionId: ef69ef6e-aa7f-4af1-a01d-ef775033524e
dockerRepository: airbyte/source-github
dockerImageTag: 0.4.9
dockerImageTag: 0.4.10
documentationUrl: https://docs.airbyte.com/integrations/sources/github
icon: github.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5172,7 +5172,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-github:0.4.9"
- dockerImage: "airbyte/source-github:0.4.10"
spec:
documentationUrl: "https://docs.airbyte.com/integrations/sources/github"
connectionSpecification:
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.4.9
LABEL io.airbyte.version=0.4.10
LABEL io.airbyte.name=airbyte/source-github
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: ef69ef6e-aa7f-4af1-a01d-ef775033524e
dockerImageTag: 0.4.9
dockerImageTag: 0.4.10
maxSecondsBetweenMessages: 5400
dockerRepository: airbyte/source-github
githubIssueLabel: source-github
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,15 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
raise e

if not any((organizations, repositories)):
raise Exception("No streams available. Please check permissions")
user_message = (
"No streams available. Looks like your config for repositories or organizations is not valid."
" Please, check your permissions, names of repositories and organizations."
)
raise AirbyteTracedException(
internal_message="No streams available. Please check permissions",
message=user_message,
failure_type=FailureType.config_error,
)

page_size = config.get("page_size_for_large_streams", DEFAULT_PAGE_SIZE_FOR_LARGE_STREAM)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pytest
import responses
from airbyte_cdk.models import AirbyteConnectionStatus, Status
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
from source_github.source import SourceGithub


Expand Down Expand Up @@ -165,3 +166,9 @@ def test_config_validation(repos_config, expected):
def tests_get_and_prepare_repositories_config(config, expected):
actual = SourceGithub._get_and_prepare_repositories_config(config)
assert actual == expected


def test_streams_no_streams_available_error():
with pytest.raises(AirbyteTracedException) as e:
SourceGithub().streams(config={"access_token": "test_token", "repository": "airbytehq/airbyte-test"})
assert str(e.value) == "No streams available. Please check permissions"
3 changes: 2 additions & 1 deletion docs/integrations/sources/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Log into [GitHub](https://github.com) and then generate a [personal access token
4. Click `Authenticate your GitHub account` by selecting Oauth or Personal Access Token for Authentication.
5. Log in and Authorize to the GitHub account.
6. **Start date** - The date from which you'd like to replicate data for streams: `comments`, `commit_comment_reactions`, `commit_comments`, `commits`, `deployments`, `events`, `issue_comment_reactions`, `issue_events`, `issue_milestones`, `issue_reactions`, `issues`, `project_cards`, `project_columns`, `projects`, `pull_request_comment_reactions`, `pull_requests`, `pull_requeststats`, `releases`, `review_comments`, `reviews`, `stargazers`, `workflow_runs`, `workflows`.
7. **GitHub Repositories** - Space-delimited list of GitHub organizations/repositories, e.g. `airbytehq/airbyte` for single repository, `airbytehq/airbyte airbytehq/another-repo` for multiple repositories. If you want to specify the organization to receive data from all its repositories, then you should specify it according to the following example: `airbytehq/*`.
7. **GitHub Repositories** - Space-delimited list of GitHub organizations/repositories, e.g. `airbytehq/airbyte` for single repository, `airbytehq/airbyte airbytehq/another-repo` for multiple repositories. If you want to specify the organization to receive data from all its repositories, then you should specify it according to the following example: `airbytehq/*`. Repositories with the wrong name, or repositories that do not exist, or have the wrong name format are not allowed.
8. **Branch (Optional)** - Space-delimited list of GitHub repository branches to pull commits for, e.g. `airbytehq/airbyte/master`. If no branches are specified for a repository, the default branch will be pulled. (e.g. `airbytehq/airbyte/master airbytehq/airbyte/my-branch`).
9. **Page size for large streams (Optional)** - The GitHub connector contains several streams with a large load. The page size of such streams depends on the size of your repository. Recommended to specify values between 10 and 30.
<!-- /env:cloud -->
Expand Down Expand Up @@ -163,6 +163,7 @@ The GitHub connector should not run into GitHub API limitations under normal usa

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0.4.10 | 2023-05-15 | [26075](https://github.com/airbytehq/airbyte/pull/26075) | Add more specific error message description for no repos case. |
| 0.4.9 | 2023-05-01 | [24523](https://github.com/airbytehq/airbyte/pull/24523) | Add undeclared columns to spec |
| 0.4.8 | 2023-04-19 | [00000](https://github.com/airbytehq/airbyte/pull/25312) | Fix repo name validation |
| 0.4.7 | 2023-03-24 | [24457](https://github.com/airbytehq/airbyte/pull/24457) | Add validation and transformation for repositories config |
Expand Down

0 comments on commit 0599080

Please sign in to comment.