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

Added support for gitlab and github #123

Merged
merged 16 commits into from
Nov 8, 2023
Merged
Prev Previous commit
Next Next commit
Resolved segment event issue
  • Loading branch information
ArpitShukla12 committed Nov 8, 2023
commit 8ff1a358fbe71ee0ecf6a305dab3beabbebbc8f6
9 changes: 3 additions & 6 deletions adapters/api/segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,27 @@ export async function sendSegmentEvent(action, body) {
authorization: `Bearer ${ATLAN_API_TOKEN}`,
"content-type": "application/json",
};
console.log("MyHeaders :", myHeaders);

const requestOptions = {
method: "POST",
headers: myHeaders,
body: body,
};
console.log("requestOptions :", requestOptions);

var response = null;
console.log("IS_DEV", IS_DEV);

if (!IS_DEV) {
response = await fetch(
`${ATLAN_INSTANCE_URL}/api/service/segment/track`,
requestOptions
)
.then((resp) => {
console.log("Inside then", resp);
console.log("send segment event", action, body);
})
.catch((err) => {
console.log("Catch err", err);
console.log("couldn't send segment event", err);
});
} else {
console.log("Wuttt");
console.log("send segment event", action, body);
}

Expand Down
3 changes: 1 addition & 2 deletions adapters/integrations/github-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export default class GitHubIntegration extends IntegrationInterface {
}

if (total_assets !== 0) {
console.log("Checking");
await this.sendSegmentEventOfIntegration({
action: "dbt_ci_action_run",
properties: {
Expand Down Expand Up @@ -863,7 +862,7 @@ ${content}`;
headSHA,
"createIssueComment"
);
console.log(content);

return content;
}

Expand Down
3 changes: 1 addition & 2 deletions adapters/integrations/gitlab-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,7 @@ ${content}`;
domain,
},
});
console.log("Action :", action);
console.log("raw", raw);

return sendSegmentEvent(action, raw);
} catch (error) {
logger.withError(
Expand Down
15 changes: 5 additions & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25379,30 +25379,27 @@ async function sendSegmentEvent(action, body) {
authorization: `Bearer ${ATLAN_API_TOKEN}`,
"content-type": "application/json",
};
console.log("MyHeaders :", myHeaders);

const requestOptions = {
method: "POST",
headers: myHeaders,
body: body,
};
console.log("requestOptions :", requestOptions);

var response = null;
console.log("IS_DEV", IS_DEV);

if (!IS_DEV) {
response = await src_fetch(
`${ATLAN_INSTANCE_URL}/api/service/segment/track`,
requestOptions
)
.then((resp) => {
console.log("Inside then", resp);
console.log("send segment event", action, body);
})
.catch((err) => {
console.log("Catch err", err);
console.log("couldn't send segment event", err);
});
} else {
console.log("Wuttt");
console.log("send segment event", action, body);
}

Expand Down Expand Up @@ -25576,7 +25573,6 @@ class GitHubIntegration extends IntegrationInterface {
}

if (total_assets !== 0) {
console.log("Checking");
await this.sendSegmentEventOfIntegration({
action: "dbt_ci_action_run",
properties: {
Expand Down Expand Up @@ -26362,7 +26358,7 @@ ${content}`;
headSHA,
"createIssueComment"
);
console.log(content);

return content;
}

Expand Down Expand Up @@ -34677,8 +34673,7 @@ ${content}`;
domain,
},
});
console.log("Action :", action);
console.log("raw", raw);

return sendSegmentEvent(action, raw);
} catch (error) {
logger_logger.withError(
Expand Down
Loading