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

DQ-457 fix(integrations): do not send segment event if totalChangedFiles is undefined #15

Merged
merged 1 commit into from
Oct 24, 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
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