diff --git a/.gitignore b/.gitignore index 7a83fc2..ecd4e64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .env +.env.gitlab +.env.github node_modules/ event.json .idea diff --git a/dist/index.js b/dist/index.js index 997d902..97376a3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17687,17 +17687,35 @@ function getCertificationImage(certificationStatus) { }, }); +;// CONCATENATED MODULE: ./src/utils/get-environment-variables.js + + + +main.config(); + +const {IS_DEV, ATLAN_INSTANCE_URL, ATLAN_API_TOKEN} = process.env; + +const isDev = () => IS_DEV === "true"; +const getInstanceUrl = () => { + if (ATLAN_INSTANCE_URL) return new URL(ATLAN_INSTANCE_URL).origin; + return new URL(core.getInput("ATLAN_INSTANCE_URL")).origin; +}; +const getAPIToken = () => { + if (ATLAN_API_TOKEN) return ATLAN_API_TOKEN; + return core.getInput("ATLAN_API_TOKEN"); +} ;// CONCATENATED MODULE: ./src/utils/create-comment.js + main.config(); -const {IS_DEV} = process.env; -const ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; +const create_comment_IS_DEV = isDev(); +const create_comment_ATLAN_INSTANCE_URL = + getInstanceUrl(); async function renderDownstreamAssetsComment( octokit, @@ -17715,7 +17733,7 @@ async function renderDownstreamAssetsComment( return [ guid, displayText, attributes.connectorName, readableTypeName, attributes?.userDescription || attributes?.description || "", attributes?.certificateStatus || "", [...attributes?.ownerUsers, ...attributes?.ownerGroups] || [], meanings.map( ({displayText, termGuid}) => - `[${displayText}](${ATLAN_INSTANCE_URL}/assets/${termGuid}?utm_source=dbt_github_action)` + `[${displayText}](${create_comment_ATLAN_INSTANCE_URL}/assets/${termGuid}/overview?utm_source=dbt_github_action)` ) ?.join(", ") || " ", attributes?.sourceURL || "" ]; @@ -17731,7 +17749,7 @@ async function renderDownstreamAssetsComment( ? getCertificationImage(certificateStatus) : ""; - return [`${connectorImage} [${displayText}](${ATLAN_INSTANCE_URL}/assets/${guid}?utm_source=dbt_github_action) ${certificationImage}`, + return [`${connectorImage} [${displayText}](${create_comment_ATLAN_INSTANCE_URL}/assets/${guid}/overview?utm_source=dbt_github_action) ${certificationImage}`, `\`${typeName}\``, description, owners.join(", ") || " ", @@ -17739,26 +17757,37 @@ async function renderDownstreamAssetsComment( sourceUrl ? `[Open in ${connectorName}](${sourceUrl})` : " "] }) - const comment = `### ${getConnectorImage(asset.attributes.connectorName)} [${ + const assetInfo = `### ${getConnectorImage(asset.attributes.connectorName)} [${ asset.displayText - }](${ATLAN_INSTANCE_URL}/assets/${asset.guid}?utm_source=dbt_github_action) ${ + }](${create_comment_ATLAN_INSTANCE_URL}/assets/${asset.guid}/overview?utm_source=dbt_github_action) ${ asset.attributes?.certificateStatus ? getCertificationImage(asset.attributes.certificateStatus) : "" - } + }` + + const downstreamTable = `**${downstreamAssets.length} downstream assets** 👇 +Name | Type | Description | Owners | Terms | Source URL +--- | --- | --- | --- | --- | --- +${rows.map((row) => row.map(i => i.replace(/\|/g, "•").replace(/\n/g, "")).join(" | ")).join("\n")}` + + const viewAssetButton = `${getImageURL("atlan-logo", 15, 15)} [View asset in Atlan](${create_comment_ATLAN_INSTANCE_URL}/assets/${asset.guid}/overview?utm_source=dbt_github_action)` + + if (downstreamAssets.length > 0) + return `${assetInfo} - **${downstreamAssets.length} downstream assets** 👇 - Name | Type | Description | Owners | Terms | Source URL - --- | --- | --- | --- | --- | --- - ${rows.map((row) => row.map(i => i.replace(/\|/g, "•").replace(/\n/g, "")).join(" | ")).join("\n")} - - ${getImageURL("atlan-logo", 15, 15)} [View asset in Atlan](${ATLAN_INSTANCE_URL}/assets/${asset.guid}?utm_source=dbt_github_action)`; +${downstreamTable} + +${viewAssetButton}`; - return comment + return `${assetInfo} + +No downstream assets found. + +${viewAssetButton}` } async function checkCommentExists(octokit, context) { - if (IS_DEV) return null; + if (create_comment_IS_DEV) return null; const {pull_request} = context.payload; @@ -17786,7 +17815,7 @@ ${content}` console.log(content) - if (IS_DEV) return content; + if (create_comment_IS_DEV) return content; if (comment_id && !forceNewComment) return octokit.rest.issues.updateComment({...commentObj, comment_id}); return octokit.rest.issues.createComment(commentObj); @@ -17881,17 +17910,14 @@ async function getAssetName({octokit, context, fileName, filePath}) { - -main.config(); - const auth_ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; -const ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getInstanceUrl() +const auth_ATLAN_API_TOKEN = + getAPIToken(); async function auth(octokit, context) { var myHeaders = { - authorization: `Bearer ${ATLAN_API_TOKEN}`, + authorization: `Bearer ${auth_ATLAN_API_TOKEN}`, "content-type": "application/json", }; @@ -17906,13 +17932,17 @@ async function auth(octokit, context) { ).catch((err) => { }); + const existingComment = await checkCommentExists(octokit, context); + + console.log("Existing Comment", existingComment) + if (response?.status === 401) { await createIssueComment(octokit, context, `We couldn't connect to your Atlan Instance, please make sure to set the valid Atlan Bearer Token as \`ATLAN_API_TOKEN\` as this repository's action secret. Atlan Instance URL: ${auth_ATLAN_INSTANCE_URL} -Set your repository action secrets [here](https://github.com/${context.payload.repository.full_name}/settings/secrets/actions). For more information on how to setup the Atlan dbt Action, please read the [setup documentation here](https://github.com/atlanhq/dbt-action/blob/main/README.md).`) +Set your repository action secrets [here](https://github.com/${context.payload.repository.full_name}/settings/secrets/actions). For more information on how to setup the Atlan dbt Action, please read the [setup documentation here](https://github.com/atlanhq/dbt-action/blob/main/README.md).`, existingComment?.id) return false } @@ -17925,7 +17955,7 @@ Atlan Instance URL: ${auth_ATLAN_INSTANCE_URL} Make sure your Atlan Instance URL is set in the following format. \`https://tenant.atlan.com\` -Set your repository action secrets [here](https://github.com/${context.payload.repository.full_name}/settings/secrets/actions). For more information on how to setup the Atlan dbt Action, please read the [setup documentation here](https://github.com/atlanhq/dbt-action/blob/main/README.md).`) +Set your repository action secrets [here](https://github.com/${context.payload.repository.full_name}/settings/secrets/actions). For more information on how to setup the Atlan dbt Action, please read the [setup documentation here](https://github.com/atlanhq/dbt-action/blob/main/README.md).`, existingComment?.id) return false } @@ -17946,14 +17976,10 @@ var stringify = __nccwpck_require__(7073); - - -main.config(); - const get_downstream_assets_ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); const get_downstream_assets_ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); async function getDownstreamAssets(asset, guid, octokit, context) { var myHeaders = { @@ -17998,7 +18024,7 @@ async function getDownstreamAssets(asset, guid, octokit, context) { var handleError = (err) => { const comment = `### ${getConnectorImage(asset.attributes.connectorName)} [${ asset.displayText - }](${get_downstream_assets_ATLAN_INSTANCE_URL}/assets/${asset.guid}?utm_source=dbt_github_action) ${ + }](${get_downstream_assets_ATLAN_INSTANCE_URL}/assets/${asset.guid}/overview?utm_source=dbt_github_action) ${ asset.attributes?.certificateStatus ? getCertificationImage(asset.attributes.certificateStatus) : "" @@ -18006,7 +18032,7 @@ async function getDownstreamAssets(asset, guid, octokit, context) { _Failed to fetch impacted assets._ -${getImageURL("atlan-logo", 15, 15)} [View lineage in Atlan](${get_downstream_assets_ATLAN_INSTANCE_URL}/assets/${asset.guid}/lineage?utm_source=dbt_github_action)`; +${getImageURL("atlan-logo", 15, 15)} [View lineage in Atlan](${get_downstream_assets_ATLAN_INSTANCE_URL}/assets/${asset.guid}/lineage/overview?utm_source=dbt_github_action)`; sendSegmentEvent("dbt_ci_action_failure", { reason: 'failed_to_fetch_lineage', @@ -18051,13 +18077,10 @@ ${getImageURL("atlan-logo", 15, 15)} [View lineage in Atlan](${get_downstream_as - -main.config(); - const get_asset_ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); const get_asset_ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); async function getAsset({name}) { var myHeaders = { @@ -18153,13 +18176,10 @@ const parse = uuid_dist/* parse */.Qc; - -main.config(); - const create_resource_ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); const create_resource_ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); async function createResource(guid, name, link) { var myHeaders = { @@ -18213,15 +18233,11 @@ async function createResource(guid, name, link) { - - -main.config(); - -const {IS_DEV: segment_IS_DEV} = process.env; +const segment_IS_DEV = isDev(); const segment_ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); const segment_ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); async function sendSegmentEvent(action, properties) { var myHeaders = { @@ -18277,6 +18293,8 @@ async function sendSegmentEvent(action, properties) { +const print_downstream_assets_ATLAN_INSTANCE_URL = getInstanceUrl() + async function printDownstreamAssets({octokit, context}) { const changedFiles = await getChangedFiles(octokit, context); diff --git a/package.json b/package.json index 4ede56b..01e54ec 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ ], "scripts": { "build": "ncc build src/index.js -o dist", - "start": "npm run build && act pull_request --container-architecture linux/amd64 --secret-file .env -e event.json", + "start": "npm run build && act pull_request --container-architecture linux/amd64 --secret-file .env -e event.json --insecure-secrets", "sync": "git pull && git push" }, "author": "Jaagrav Seal (https://atlan.com/)", diff --git a/src/api/create-resource.js b/src/api/create-resource.js index b053012..1a27dec 100644 --- a/src/api/create-resource.js +++ b/src/api/create-resource.js @@ -1,16 +1,13 @@ import {v4 as uuidv4} from "uuid"; import fetch from "node-fetch"; -import core from "@actions/core"; -import dotenv from "dotenv"; import {sendSegmentEvent} from "./index.js"; import stringify from 'json-stringify-safe'; - -dotenv.config(); +import {getAPIToken, getInstanceUrl} from "../utils/index.js"; const ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); const ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); export default async function createResource(guid, name, link) { var myHeaders = { diff --git a/src/api/get-asset.js b/src/api/get-asset.js index 2a6765e..951a2b7 100644 --- a/src/api/get-asset.js +++ b/src/api/get-asset.js @@ -1,15 +1,12 @@ import fetch from "node-fetch"; -import core from "@actions/core"; -import dotenv from "dotenv"; import {sendSegmentEvent} from "./index.js"; import stringify from 'json-stringify-safe'; - -dotenv.config(); +import {getAPIToken, getInstanceUrl} from "../utils/index.js"; const ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); const ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); export default async function getAsset({name}) { var myHeaders = { diff --git a/src/api/get-downstream-assets.js b/src/api/get-downstream-assets.js index 0ddcf11..ac833e6 100644 --- a/src/api/get-downstream-assets.js +++ b/src/api/get-downstream-assets.js @@ -1,16 +1,12 @@ import fetch from "node-fetch"; -import core from "@actions/core"; -import dotenv from "dotenv"; import {sendSegmentEvent} from "./index.js"; -import {createIssueComment, getConnectorImage, getCertificationImage, getImageURL} from "../utils/index.js"; +import {getAPIToken, getInstanceUrl, getConnectorImage, getCertificationImage, getImageURL} from "../utils/index.js"; import stringify from 'json-stringify-safe'; -dotenv.config(); - const ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); const ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); export default async function getDownstreamAssets(asset, guid, octokit, context) { var myHeaders = { @@ -55,7 +51,7 @@ export default async function getDownstreamAssets(asset, guid, octokit, context) var handleError = (err) => { const comment = `### ${getConnectorImage(asset.attributes.connectorName)} [${ asset.displayText - }](${ATLAN_INSTANCE_URL}/assets/${asset.guid}?utm_source=dbt_github_action) ${ + }](${ATLAN_INSTANCE_URL}/assets/${asset.guid}/overview?utm_source=dbt_github_action) ${ asset.attributes?.certificateStatus ? getCertificationImage(asset.attributes.certificateStatus) : "" @@ -63,7 +59,7 @@ export default async function getDownstreamAssets(asset, guid, octokit, context) _Failed to fetch impacted assets._ -${getImageURL("atlan-logo", 15, 15)} [View lineage in Atlan](${ATLAN_INSTANCE_URL}/assets/${asset.guid}/lineage?utm_source=dbt_github_action)`; +${getImageURL("atlan-logo", 15, 15)} [View lineage in Atlan](${ATLAN_INSTANCE_URL}/assets/${asset.guid}/lineage/overview?utm_source=dbt_github_action)`; sendSegmentEvent("dbt_ci_action_failure", { reason: 'failed_to_fetch_lineage', diff --git a/src/api/segment.js b/src/api/segment.js index c264776..27d22ea 100644 --- a/src/api/segment.js +++ b/src/api/segment.js @@ -1,17 +1,13 @@ import fetch from "node-fetch"; -import core from "@actions/core"; -import dotenv from "dotenv"; import {context} from "@actions/github"; import stringify from 'json-stringify-safe'; +import {isDev, getAPIToken, getInstanceUrl} from "../utils/index.js"; - -dotenv.config(); - -const {IS_DEV} = process.env; +const IS_DEV = isDev(); const ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); const ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); export default async function sendSegmentEvent(action, properties) { var myHeaders = { diff --git a/src/main/print-downstream-assets.js b/src/main/print-downstream-assets.js index 12bc8f4..b06b459 100644 --- a/src/main/print-downstream-assets.js +++ b/src/main/print-downstream-assets.js @@ -6,9 +6,11 @@ import { import { renderDownstreamAssetsComment, getChangedFiles, - getAssetName, createIssueComment, checkCommentExists, deleteComment, getImageURL + getAssetName, createIssueComment, checkCommentExists, deleteComment, getImageURL, getInstanceUrl } from "../utils/index.js"; +const ATLAN_INSTANCE_URL = getInstanceUrl() + export default async function printDownstreamAssets({octokit, context}) { const changedFiles = await getChangedFiles(octokit, context); diff --git a/src/utils/auth.js b/src/utils/auth.js index c5fcbfa..5964c22 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -1,14 +1,11 @@ import fetch from "node-fetch"; -import dotenv from "dotenv"; -import core from "@actions/core"; -import {createIssueComment} from "./create-comment.js"; - -dotenv.config(); +import {checkCommentExists, createIssueComment} from "./create-comment.js"; +import {getAPIToken, getInstanceUrl} from "./get-environment-variables.js"; const ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl() const ATLAN_API_TOKEN = - core.getInput("ATLAN_API_TOKEN") || process.env.ATLAN_API_TOKEN; + getAPIToken(); export default async function auth(octokit, context) { var myHeaders = { @@ -27,13 +24,17 @@ export default async function auth(octokit, context) { ).catch((err) => { }); + const existingComment = await checkCommentExists(octokit, context); + + console.log("Existing Comment", existingComment) + if (response?.status === 401) { await createIssueComment(octokit, context, `We couldn't connect to your Atlan Instance, please make sure to set the valid Atlan Bearer Token as \`ATLAN_API_TOKEN\` as this repository's action secret. Atlan Instance URL: ${ATLAN_INSTANCE_URL} -Set your repository action secrets [here](https://github.com/${context.payload.repository.full_name}/settings/secrets/actions). For more information on how to setup the Atlan dbt Action, please read the [setup documentation here](https://github.com/atlanhq/dbt-action/blob/main/README.md).`) +Set your repository action secrets [here](https://github.com/${context.payload.repository.full_name}/settings/secrets/actions). For more information on how to setup the Atlan dbt Action, please read the [setup documentation here](https://github.com/atlanhq/dbt-action/blob/main/README.md).`, existingComment?.id) return false } @@ -46,7 +47,7 @@ Atlan Instance URL: ${ATLAN_INSTANCE_URL} Make sure your Atlan Instance URL is set in the following format. \`https://tenant.atlan.com\` -Set your repository action secrets [here](https://github.com/${context.payload.repository.full_name}/settings/secrets/actions). For more information on how to setup the Atlan dbt Action, please read the [setup documentation here](https://github.com/atlanhq/dbt-action/blob/main/README.md).`) +Set your repository action secrets [here](https://github.com/${context.payload.repository.full_name}/settings/secrets/actions). For more information on how to setup the Atlan dbt Action, please read the [setup documentation here](https://github.com/atlanhq/dbt-action/blob/main/README.md).`, existingComment?.id) return false } diff --git a/src/utils/create-comment.js b/src/utils/create-comment.js index 1abb712..2445997 100644 --- a/src/utils/create-comment.js +++ b/src/utils/create-comment.js @@ -1,13 +1,9 @@ -import dotenv from "dotenv"; -import core from "@actions/core"; - import {getCertificationImage, getConnectorImage, getImageURL,} from "./index.js"; +import {getInstanceUrl, isDev} from "./get-environment-variables.js"; -dotenv.config(); - -const {IS_DEV} = process.env; +const IS_DEV = isDev(); const ATLAN_INSTANCE_URL = - core.getInput("ATLAN_INSTANCE_URL") || process.env.ATLAN_INSTANCE_URL; + getInstanceUrl(); export default async function renderDownstreamAssetsComment( octokit, @@ -25,7 +21,7 @@ export default async function renderDownstreamAssetsComment( return [ guid, displayText, attributes.connectorName, readableTypeName, attributes?.userDescription || attributes?.description || "", attributes?.certificateStatus || "", [...attributes?.ownerUsers, ...attributes?.ownerGroups] || [], meanings.map( ({displayText, termGuid}) => - `[${displayText}](${ATLAN_INSTANCE_URL}/assets/${termGuid}?utm_source=dbt_github_action)` + `[${displayText}](${ATLAN_INSTANCE_URL}/assets/${termGuid}/overview?utm_source=dbt_github_action)` ) ?.join(", ") || " ", attributes?.sourceURL || "" ]; @@ -41,7 +37,7 @@ export default async function renderDownstreamAssetsComment( ? getCertificationImage(certificateStatus) : ""; - return [`${connectorImage} [${displayText}](${ATLAN_INSTANCE_URL}/assets/${guid}?utm_source=dbt_github_action) ${certificationImage}`, + return [`${connectorImage} [${displayText}](${ATLAN_INSTANCE_URL}/assets/${guid}/overview?utm_source=dbt_github_action) ${certificationImage}`, `\`${typeName}\``, description, owners.join(", ") || " ", @@ -49,22 +45,33 @@ export default async function renderDownstreamAssetsComment( sourceUrl ? `[Open in ${connectorName}](${sourceUrl})` : " "] }) - const comment = `### ${getConnectorImage(asset.attributes.connectorName)} [${ + const assetInfo = `### ${getConnectorImage(asset.attributes.connectorName)} [${ asset.displayText - }](${ATLAN_INSTANCE_URL}/assets/${asset.guid}?utm_source=dbt_github_action) ${ + }](${ATLAN_INSTANCE_URL}/assets/${asset.guid}/overview?utm_source=dbt_github_action) ${ asset.attributes?.certificateStatus ? getCertificationImage(asset.attributes.certificateStatus) : "" - } + }` + + const downstreamTable = `**${downstreamAssets.length} downstream assets** 👇 +Name | Type | Description | Owners | Terms | Source URL +--- | --- | --- | --- | --- | --- +${rows.map((row) => row.map(i => i.replace(/\|/g, "•").replace(/\n/g, "")).join(" | ")).join("\n")}` + + const viewAssetButton = `${getImageURL("atlan-logo", 15, 15)} [View asset in Atlan](${ATLAN_INSTANCE_URL}/assets/${asset.guid}/overview?utm_source=dbt_github_action)` + + if (downstreamAssets.length > 0) + return `${assetInfo} - **${downstreamAssets.length} downstream assets** 👇 - Name | Type | Description | Owners | Terms | Source URL - --- | --- | --- | --- | --- | --- - ${rows.map((row) => row.map(i => i.replace(/\|/g, "•").replace(/\n/g, "")).join(" | ")).join("\n")} - - ${getImageURL("atlan-logo", 15, 15)} [View asset in Atlan](${ATLAN_INSTANCE_URL}/assets/${asset.guid}?utm_source=dbt_github_action)`; - - return comment +${downstreamTable} + +${viewAssetButton}`; + + return `${assetInfo} + +No downstream assets found. + +${viewAssetButton}` } export async function checkCommentExists(octokit, context) { diff --git a/src/utils/get-environment-variables.js b/src/utils/get-environment-variables.js new file mode 100644 index 0000000..3bb18ba --- /dev/null +++ b/src/utils/get-environment-variables.js @@ -0,0 +1,16 @@ +import dotenv from "dotenv"; +import core from "@actions/core"; + +dotenv.config(); + +const {IS_DEV, ATLAN_INSTANCE_URL, ATLAN_API_TOKEN} = process.env; + +export const isDev = () => IS_DEV === "true"; +export const getInstanceUrl = () => { + if (ATLAN_INSTANCE_URL) return new URL(ATLAN_INSTANCE_URL).origin; + return new URL(core.getInput("ATLAN_INSTANCE_URL")).origin; +}; +export const getAPIToken = () => { + if (ATLAN_API_TOKEN) return ATLAN_API_TOKEN; + return core.getInput("ATLAN_API_TOKEN"); +} \ No newline at end of file diff --git a/src/utils/index.js b/src/utils/index.js index f0e577a..8781d6e 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -16,3 +16,8 @@ export { export { default as auth } from "./auth.js" +export { + getAPIToken, + getInstanceUrl, + isDev +} from "./get-environment-variables.js" \ No newline at end of file