Skip to content

Commit 478a5a8

Browse files
authoredOct 24, 2024··
Merge pull request #15 from atlanhq/DQ-457-ia-analytics
DQ-457 fix(integrations): do not send segment event if totalChangedFiles is undefined
2 parents d82b59f + d478f8f commit 478a5a8

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed
 

‎adapters/integrations/atlan-contract-impact-analysis-github.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default class ContractIntegration extends IntegrationInterface {
7676
total_assets = await this.printDownstreamAssets({ octokit, context });
7777
}
7878

79-
if (total_assets !== 0) {
79+
if (total_assets !== 0 && total_assets != undefined) {
8080
await this.sendSegmentEventOfIntegration({
8181
action: `${actionName}_run`,
8282
properties: {
@@ -112,7 +112,6 @@ export default class ContractIntegration extends IntegrationInterface {
112112
);
113113

114114
try {
115-
const changedFiles = await this.getChangedFiles({ octokit, context });
116115
let comments = ``;
117116
let warningComments = ``;
118117
let totalChangedFiles = 0;
@@ -144,6 +143,8 @@ export default class ContractIntegration extends IntegrationInterface {
144143
return;
145144
}
146145

146+
const changedFiles = await this.getChangedFiles({ octokit, context });
147+
147148
for (const { fileName, filePath, status } of changedFiles) {
148149
// Skipping non yaml files
149150
if (!filePath.endsWith('.yaml') && !filePath.endsWith('.yml')) {

‎adapters/integrations/github-integration.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default class GitHubIntegration extends IntegrationInterface {
7878
total_assets = await this.setResourceOnAsset({ octokit, context });
7979
}
8080

81-
if (total_assets !== 0) {
81+
if (total_assets !== 0 && total_assets != undefined) {
8282
await this.sendSegmentEventOfIntegration({
8383
action: "dbt_ci_action_run",
8484
properties: {

‎adapters/integrations/gitlab-integration.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { Gitlab } from "@gitbeaker/rest";
4343
import IntegrationInterface from "./contract/contract.js";
4444
import logger from "../logger/logger.js";
4545
import stringify from "json-stringify-safe";
46+
4647
const integrationName = "gitlab";
4748
var CI_MERGE_REQUEST_IID;
4849

@@ -117,7 +118,7 @@ export default class GitLabIntegration extends IntegrationInterface {
117118
});
118119
}
119120

120-
if (total_assets !== 0)
121+
if (total_assets !== 0 && total_assets != undefined)
121122
await this.sendSegmentEventOfIntegration({
122123
action: "dbt_ci_action_run",
123124
properties: {

‎dist/index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -29832,7 +29832,7 @@ class ContractIntegration extends IntegrationInterface {
2983229832
total_assets = await this.printDownstreamAssets({ octokit, context });
2983329833
}
2983429834

29835-
if (total_assets !== 0) {
29835+
if (total_assets !== 0 && total_assets != undefined) {
2983629836
await this.sendSegmentEventOfIntegration({
2983729837
action: `${actionName}_run`,
2983829838
properties: {
@@ -29868,7 +29868,6 @@ class ContractIntegration extends IntegrationInterface {
2986829868
);
2986929869

2987029870
try {
29871-
const changedFiles = await this.getChangedFiles({ octokit, context });
2987229871
let comments = ``;
2987329872
let warningComments = ``;
2987429873
let totalChangedFiles = 0;
@@ -29900,6 +29899,8 @@ class ContractIntegration extends IntegrationInterface {
2990029899
return;
2990129900
}
2990229901

29902+
const changedFiles = await this.getChangedFiles({ octokit, context });
29903+
2990329904
for (const { fileName, filePath, status } of changedFiles) {
2990429905
// Skipping non yaml files
2990529906
if (!filePath.endsWith('.yaml') && !filePath.endsWith('.yml')) {
@@ -30685,7 +30686,7 @@ class GitHubIntegration extends IntegrationInterface {
3068530686
total_assets = await this.setResourceOnAsset({ octokit, context });
3068630687
}
3068730688

30688-
if (total_assets !== 0) {
30689+
if (total_assets !== 0 && total_assets != undefined) {
3068930690
await this.sendSegmentEventOfIntegration({
3069030691
action: "dbt_ci_action_run",
3069130692
properties: {
@@ -39182,6 +39183,7 @@ var {
3918239183

3918339184

3918439185

39186+
3918539187
const gitlab_integration_integrationName = "gitlab";
3918639188
var CI_MERGE_REQUEST_IID;
3918739189

@@ -39256,7 +39258,7 @@ class GitLabIntegration extends IntegrationInterface {
3925639258
});
3925739259
}
3925839260

39259-
if (total_assets !== 0)
39261+
if (total_assets !== 0 && total_assets != undefined)
3926039262
await this.sendSegmentEventOfIntegration({
3926139263
action: "dbt_ci_action_run",
3926239264
properties: {

0 commit comments

Comments
 (0)
Please sign in to comment.