From 599ab7cfcd685cf6a5b4999f0f2fbe7f0bfac641 Mon Sep 17 00:00:00 2001 From: Arsen Losenko <20901439+arsenlosenko@users.noreply.github.com> Date: Fri, 22 Sep 2023 19:12:49 +0300 Subject: [PATCH] Source Github: rewrite source connection error messages (#30654) Co-authored-by: Serhii Lazebnyi <53845333+lazebnyi@users.noreply.github.com> --- airbyte-integrations/connectors/source-github/Dockerfile | 2 +- .../connectors/source-github/metadata.yaml | 2 +- .../connectors/source-github/source_github/source.py | 9 +++++++-- docs/integrations/sources/github.md | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/airbyte-integrations/connectors/source-github/Dockerfile b/airbyte-integrations/connectors/source-github/Dockerfile index 3d19a771f62f..a875c6ed949f 100644 --- a/airbyte-integrations/connectors/source-github/Dockerfile +++ b/airbyte-integrations/connectors/source-github/Dockerfile @@ -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=1.1.0 +LABEL io.airbyte.version=1.1.1 LABEL io.airbyte.name=airbyte/source-github diff --git a/airbyte-integrations/connectors/source-github/metadata.yaml b/airbyte-integrations/connectors/source-github/metadata.yaml index ca602652b583..354dd03272d7 100644 --- a/airbyte-integrations/connectors/source-github/metadata.yaml +++ b/airbyte-integrations/connectors/source-github/metadata.yaml @@ -5,7 +5,7 @@ data: connectorSubtype: api connectorType: source definitionId: ef69ef6e-aa7f-4af1-a01d-ef775033524e - dockerImageTag: 1.1.0 + dockerImageTag: 1.1.1 maxSecondsBetweenMessages: 5400 dockerRepository: airbyte/source-github githubIssueLabel: source-github diff --git a/airbyte-integrations/connectors/source-github/source_github/source.py b/airbyte-integrations/connectors/source-github/source_github/source.py index a1fc567a091a..9f36f9345abc 100644 --- a/airbyte-integrations/connectors/source-github/source_github/source.py +++ b/airbyte-integrations/connectors/source-github/source_github/source.py @@ -188,7 +188,9 @@ def user_friendly_error_message(self, message: str) -> str: user_message = f'Organization name: "{org_name}" is unknown, "repository" config option should be updated' elif "401 Client Error: Unauthorized for url" in message: # 401 Client Error: Unauthorized for url: https://api.github.com/orgs/datarootsio/repos?per_page=100&sort=updated&direction=desc - user_message = "Bad credentials, re-authentication or access token renewal is required" + user_message = ( + "Github credentials have expired or changed, please review your credentials and re-authenticate or renew your access token." + ) return user_message def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, Any]: @@ -196,7 +198,10 @@ def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> authenticator = self._get_authenticator(config) _, repositories = self._get_org_repositories(config=config, authenticator=authenticator) if not repositories: - return False, "Invalid repositories. Valid examples: airbytehq/airbyte airbytehq/another-repo airbytehq/* airbytehq/airbyte" + return ( + False, + "Some of the provided repositories couldn't be found. Please verify if every entered repository has a valid name and it matches the following format: airbytehq/airbyte airbytehq/another-repo airbytehq/* airbytehq/airbyte.", + ) return True, None except Exception as e: diff --git a/docs/integrations/sources/github.md b/docs/integrations/sources/github.md index 5587e6ce6b9a..79dce433bc2c 100644 --- a/docs/integrations/sources/github.md +++ b/docs/integrations/sources/github.md @@ -164,6 +164,7 @@ The GitHub connector should not run into GitHub API limitations under normal usa | Version | Date | Pull Request | Subject | |:--------|:-----------|:------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 1.1.1 | 2023-09-21 | [30654](https://github.com/airbytehq/airbyte/pull/30654) | Rewrite source connection error messages | | 1.1.0 | 2023-08-03 | [30615](https://github.com/airbytehq/airbyte/pull/30615) | Add new stream `Contributor Activity` | | 1.0.4 | 2023-08-03 | [29031](https://github.com/airbytehq/airbyte/pull/29031) | Reverted `advancedAuth` spec changes | | 1.0.3 | 2023-08-01 | [28910](https://github.com/airbytehq/airbyte/pull/28910) | Updated `advancedAuth` broken references |