diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index abe8177..cf1f2d4 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -27,4 +27,5 @@ jobs: DBT_ENVIRONMENT_BRANCH_MAP: | main: DBT-DEMO-PROD beta: Wide World Importers PE1 - test-action: Wide World Importers PE1 \ No newline at end of file + test-action: Wide World Importers PE1 + IGNORE_MODEL_ALIAS_MATCHING: true \ No newline at end of file diff --git a/action.yml b/action.yml index f4bdd00..ebc4883 100644 --- a/action.yml +++ b/action.yml @@ -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" diff --git a/package-lock.json b/package-lock.json index 6cf97ee..26e95ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -148,9 +148,9 @@ } }, "node_modules/@octokit/request/node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", "dependencies": { "whatwg-url": "^5.0.0" }, diff --git a/src/main/print-downstream-assets.js b/src/main/print-downstream-assets.js index b5e7b1d..788bc04 100644 --- a/src/main/print-downstream-assets.js +++ b/src/main/print-downstream-assets.js @@ -8,6 +8,7 @@ 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); @@ -15,7 +16,9 @@ export default async function printDownstreamAssets({octokit, context}) { 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) diff --git a/src/utils/file-system.js b/src/utils/file-system.js index 035882f..e799587 100644 --- a/src/utils/file-system.js +++ b/src/utils/file-system.js @@ -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 } diff --git a/src/utils/get-environment-variables.js b/src/utils/get-environment-variables.js index 3bb18ba..185ad9a 100644 --- a/src/utils/get-environment-variables.js +++ b/src/utils/get-environment-variables.js @@ -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 = () => { @@ -13,4 +13,5 @@ export const getInstanceUrl = () => { export const getAPIToken = () => { if (ATLAN_API_TOKEN) return ATLAN_API_TOKEN; return core.getInput("ATLAN_API_TOKEN"); -} \ No newline at end of file +} +export const isIgnoreModelAliasMatching = () => core.getInput("IGNORE_MODEL_ALIAS_MATCHING") === "true"; \ No newline at end of file