Skip to content

Commit

Permalink
Merge pull request #15 from atlanhq/DQ-457-ia-analytics
Browse files Browse the repository at this point in the history
DQ-457 fix(integrations): do not send segment event if totalChangedFiles is undefined
  • Loading branch information
rittikdasgupta authored Oct 24, 2024
2 parents d82b59f + d478f8f commit 478a5a8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class ContractIntegration extends IntegrationInterface {
total_assets = await this.printDownstreamAssets({ octokit, context });
}

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

try {
const changedFiles = await this.getChangedFiles({ octokit, context });
let comments = ``;
let warningComments = ``;
let totalChangedFiles = 0;
Expand Down Expand Up @@ -144,6 +143,8 @@ export default class ContractIntegration extends IntegrationInterface {
return;
}

const changedFiles = await this.getChangedFiles({ octokit, context });

for (const { fileName, filePath, status } of changedFiles) {
// Skipping non yaml files
if (!filePath.endsWith('.yaml') && !filePath.endsWith('.yml')) {
Expand Down
2 changes: 1 addition & 1 deletion adapters/integrations/github-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class GitHubIntegration extends IntegrationInterface {
total_assets = await this.setResourceOnAsset({ octokit, context });
}

if (total_assets !== 0) {
if (total_assets !== 0 && total_assets != undefined) {
await this.sendSegmentEventOfIntegration({
action: "dbt_ci_action_run",
properties: {
Expand Down
3 changes: 2 additions & 1 deletion adapters/integrations/gitlab-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { Gitlab } from "@gitbeaker/rest";
import IntegrationInterface from "./contract/contract.js";
import logger from "../logger/logger.js";
import stringify from "json-stringify-safe";

const integrationName = "gitlab";
var CI_MERGE_REQUEST_IID;

Expand Down Expand Up @@ -117,7 +118,7 @@ export default class GitLabIntegration extends IntegrationInterface {
});
}

if (total_assets !== 0)
if (total_assets !== 0 && total_assets != undefined)
await this.sendSegmentEventOfIntegration({
action: "dbt_ci_action_run",
properties: {
Expand Down
10 changes: 6 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29832,7 +29832,7 @@ class ContractIntegration extends IntegrationInterface {
total_assets = await this.printDownstreamAssets({ octokit, context });
}

if (total_assets !== 0) {
if (total_assets !== 0 && total_assets != undefined) {
await this.sendSegmentEventOfIntegration({
action: `${actionName}_run`,
properties: {
Expand Down Expand Up @@ -29868,7 +29868,6 @@ class ContractIntegration extends IntegrationInterface {
);

try {
const changedFiles = await this.getChangedFiles({ octokit, context });
let comments = ``;
let warningComments = ``;
let totalChangedFiles = 0;
Expand Down Expand Up @@ -29900,6 +29899,8 @@ class ContractIntegration extends IntegrationInterface {
return;
}

const changedFiles = await this.getChangedFiles({ octokit, context });

for (const { fileName, filePath, status } of changedFiles) {
// Skipping non yaml files
if (!filePath.endsWith('.yaml') && !filePath.endsWith('.yml')) {
Expand Down Expand Up @@ -30685,7 +30686,7 @@ class GitHubIntegration extends IntegrationInterface {
total_assets = await this.setResourceOnAsset({ octokit, context });
}

if (total_assets !== 0) {
if (total_assets !== 0 && total_assets != undefined) {
await this.sendSegmentEventOfIntegration({
action: "dbt_ci_action_run",
properties: {
Expand Down Expand Up @@ -39182,6 +39183,7 @@ var {




const gitlab_integration_integrationName = "gitlab";
var CI_MERGE_REQUEST_IID;

Expand Down Expand Up @@ -39256,7 +39258,7 @@ class GitLabIntegration extends IntegrationInterface {
});
}

if (total_assets !== 0)
if (total_assets !== 0 && total_assets != undefined)
await this.sendSegmentEventOfIntegration({
action: "dbt_ci_action_run",
properties: {
Expand Down

0 comments on commit 478a5a8

Please sign in to comment.