diff --git a/dist/index.js b/dist/index.js index d33ec7332..d33fbe83c 100755 --- a/dist/index.js +++ b/dist/index.js @@ -17801,8 +17801,8 @@ const createProfileDetailsCard = async function (username) { contributionsData, theme ); - //output to folder - writeSVG(themeName, "profile-details", svgString); + //output to folder, use 0- prefix for sort in preview + writeSVG(themeName, "0-profile-details", svgString); } }; @@ -17825,9 +17825,13 @@ const createReposPerLanguageCard = async function (username) { for (let themeName in Themes) { let theme = Themes[themeName]; - let svgString = createDonutChartCard("Repos per Language (top 5)", langData, theme); - //output to folder - writeSVG(themeName, "repos-per-language", svgString); + let svgString = createDonutChartCard( + "Repos per Language (top 5)", + langData, + theme + ); + //output to folder, use 1- prefix for sort in preview + writeSVG(themeName, "1-repos-per-language", svgString); } }; @@ -17870,8 +17874,8 @@ const createCommitsPerLanguageCard = async function (username) { langData, theme ); - //output to folder - writeSVG(themeName, "most-commit-language", svgString); + //output to folder, use 2- prefix for sort in preview + writeSVG(themeName, "2-most-commit-language", svgString); } }; @@ -17951,13 +17955,13 @@ const main = async () => { } catch (error) { core.error(`Error when creating CommitsPerLanguageCard \n${error}`); } + try { + core.info(`Createing preview markdown...`); + await generatePreviewMarkdown(isInGithubAction); + } catch (error) { + core.error(`Error when creating preview markdown \n${error}`); + } if (isInGithubAction) { - try { - core.info(`Createing preview markdown...`); - await generatePreviewMarkdown(); - } catch (error) { - core.error(`Error when creating preview markdown \n${error}`); - } core.info(`Commit file...`); await commitFile(); } @@ -20295,7 +20299,10 @@ const Themes = __webpack_require__(4637); const GITHUB_REPOSITORY = process.env.GITHUB_REPOSITORY; // If neither a branch or tag is available for the event type, the variable will not exist. https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables -const GITHUB_BRANCH = process.env.GITHUB_REF == undefined ? "master":process.env.GITHUB_REF.split("/").pop(); +const GITHUB_BRANCH = + process.env.GITHUB_REF == undefined + ? "master" + : process.env.GITHUB_REF.split("/").pop(); const writeSVG = function (folder, filename, svgString) { const targetFolder = `${outputPath}${folder}/`; @@ -20316,11 +20323,13 @@ function getAllFileInFolder(folder) { return files; } -const generatePreviewMarkdown = function (pro) { +const generatePreviewMarkdown = function (isInGithubAction) { let targetFolder = `${outputPath}`; let readmeContent = ""; - readmeContent += -` + let urlPrefix = isInGithubAction + ? `https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${GITHUB_BRANCH}/profile-summary-card-output` + : `.`; + readmeContent += ` # Preview Cards Here are all cards with themes. @@ -20328,17 +20337,16 @@ Here are all cards with themes. `; for (let themeName in Themes) { - readmeContent += -` + readmeContent += ` ### ${themeName} `; for (let file of getAllFileInFolder(targetFolder + themeName)) { readmeContent += ` \`\`\` -![](https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${GITHUB_BRANCH}/profile-summary-card-output/${themeName}/${file}) +![](${urlPrefix}/${themeName}/${file}) \`\`\` -![](https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${GITHUB_BRANCH}/profile-summary-card-output/${themeName}/${file}) +![](${urlPrefix}/${themeName}/${file}) `; } diff --git a/package.json b/package.json index 5f259a3a7..da120742e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-profile-summary-cards", - "version": "0.0.1", + "version": "0.1.2", "description": "Generate github profile summary cards", "main": "src/app.js", "scripts": {