Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marcos/zendesk update ci #41

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/ci/get_connector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
def extract_connector_name(file_path):
connector_names = set()
with open(file_path, "r") as file:
for line in file:
line = line.strip()
if line.startswith("connectors/"):
parts = line.split("/")
if len(parts) > 1:
connector_names.add(parts[1])
if len(connector_names) == 0:
raise ValueError("No connector name found in the file.")
elif len(connector_names) > 1:
raise ValueError("Multiple connector names found in the file.")

return connector_names


# Example usage:
file_path = "changed_files.txt"
try:
connector_name = extract_connector_name(file_path)
print(f"::set-output name=connector::{next(iter(connector_name))}")
except Exception as e:
print(e)
print("::set-output name=connector::not-found")
6 changes: 5 additions & 1 deletion .github/workflows/run_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ jobs:

- name: Get what connector we are testing
id: get_connector
run: echo "::set-output name=connector::source_zendesk_support"
run: |
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1
git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }} > changed_files.txt
cat changed_files.txt
python .github/ci/get_connector.py

- name: Run Integration Tests for Postgres
working-directory: connectors/${{ steps.get_connector.outputs.connector }}/integration_tests
Expand Down
3 changes: 3 additions & 0 deletions changed_files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github/ci/get_connector.py
.github/workflows/run_integration_tests.yml
connectors/source_zendesk_support/models/fivetran_converter/ticket_field_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
f.value:field_name::STRING AS FIELD_NAME,
f.value:value::STRING AS VALUE,
t.author_id as AUTHOR_ID,
t.created_at as UPDATED_AT,
t.created_at as UPDATED
FROM
{{ source('source_zendesk_support', 'ticket_audits') }} t,
LATERAL FLATTEN(input => t.events) f
Expand All @@ -21,7 +21,7 @@
JSON_EXTRACT_SCALAR(f, '$.field_name') AS FIELD_NAME,
JSON_EXTRACT_SCALAR(f, '$.value') AS VALUE,
t.author_id AS AUTHOR_ID,
t.created_at AS UPDATED_AT
t.created_at AS UPDATED
FROM
{{ source('source_zendesk_support', 'ticket_audits') }} t,
UNNEST(JSON_EXTRACT_ARRAY(t.events)) AS f
Expand All @@ -33,11 +33,11 @@

WITH tmp AS (
SELECT
t.id AS TICKET_ID,
f.value->>'field_name' AS FIELD_NAME,
f.value->>'value' AS VALUE,
t.author_id AS AUTHOR_ID,
t.created_at AS UPDATED_AT
t.id AS ticket_id,
f.value->>'field_name' AS field_name,
f.value->>'value' AS value,
t.author_id AS author_id,
t.created_at AS updated
FROM
{{ source('source_zendesk_support', 'ticket_audits') }} t,
LATERAL jsonb_array_elements(t.events::jsonb) AS f(value)
Expand Down
Loading