Skip to content

Commit

Permalink
feat: ignore model alias matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaagrav committed May 14, 2023
1 parent ed079a5 commit 2b9b0b8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ jobs:
DBT_ENVIRONMENT_BRANCH_MAP: |
main: DBT-DEMO-PROD
beta: Wide World Importers PE1
test-action: Wide World Importers PE1
test-action: Wide World Importers PE1
IGNORE_MODEL_ALIAS_MATCHING: true
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ inputs:
DBT_ENVIRONMENT_BRANCH_MAP:
description: "List of environments"
required: false

IGNORE_MODEL_ALIAS_MATCHING:
description: "Ignore model alias matching"
required: false
default: false
runs:
using: "node16"
main: "dist/index.js"
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/main/print-downstream-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import {
getChangedFiles,
getAssetName, createIssueComment, checkCommentExists, deleteComment, getImageURL, getConnectorImage
} from "../utils/index.js";
import {isIgnoreModelAliasMatching} from "../utils/get-environment-variables.js";

export default async function printDownstreamAssets({octokit, context}) {
const changedFiles = await getChangedFiles(octokit, context);
let comments = ``;
let totalChangedFiles = 0;

for (const {fileName, filePath, status} of changedFiles) {
const assetName = await getAssetName({octokit, context, fileName, filePath});
const aliasName = await getAssetName({octokit, context, fileName, filePath});
const assetName = isIgnoreModelAliasMatching() ? fileName : aliasName;
console.log("Ignore Model Alias Matching?", isIgnoreModelAliasMatching())
const asset = await getAsset({name: assetName});

if (totalChangedFiles !== 0)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/file-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function getChangedFiles(octokit, context) {
return changedFiles.findIndex(obj => obj.fileName === item.fileName) === index;
})

console.log(changedFiles)
console.log("Changed Files: ", changedFiles)

return changedFiles
}
Expand Down
5 changes: 3 additions & 2 deletions src/utils/get-environment-variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import core from "@actions/core";

dotenv.config();

const {IS_DEV, ATLAN_INSTANCE_URL, ATLAN_API_TOKEN} = process.env;
const {IS_DEV, ATLAN_INSTANCE_URL, ATLAN_API_TOKEN, IGNORE_MODEL_ALIAS_MATCHING} = process.env;

export const isDev = () => IS_DEV === "true";
export const getInstanceUrl = () => {
Expand All @@ -13,4 +13,5 @@ export const getInstanceUrl = () => {
export const getAPIToken = () => {
if (ATLAN_API_TOKEN) return ATLAN_API_TOKEN;
return core.getInput("ATLAN_API_TOKEN");
}
}
export const isIgnoreModelAliasMatching = () => core.getInput("IGNORE_MODEL_ALIAS_MATCHING") === "true";

0 comments on commit 2b9b0b8

Please sign in to comment.