fix: normalize template file loadup

This commit is contained in:
Simone Corsi
2022-05-11 10:00:38 +02:00
parent ec10b79a91
commit 445f562fb5
3 changed files with 19 additions and 17 deletions

View File

@@ -1,5 +1,6 @@
import path from 'path';
import * as core from '@actions/core';
import { readdir, readFile } from 'fs/promises';
import { readFile } from 'fs/promises';
import ghStarFetch from 'gh-star-fetch';
import {
@@ -9,11 +10,13 @@ import {
pushNewFiles,
MARKDOWN_FILENAME,
} from './helpers';
import MD_TEMPLATE from './template';
export async function main() {
// set default template
let template = MD_TEMPLATE;
let template = await readFile(
path.resolve(__dirname, './TEMPLATE.md'),
'utf8'
);
// get template if found in the repo
const customTemplatePath = core.getInput('template-path');

View File

@@ -1,14 +0,0 @@
export default `# <%= username %> Awesome List [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)
> :star: generated with [simonecorsi/mawesome](https://github.com/simonecorsi/mawesome)
## Table of Contents
<% for(let [language, repositories] of stars) { %>
## <%= language %>
<% for(let repo of repositories) { %>- [<%= repo.full_name %>](<%= repo.html_url %>) - <%= repo.description %>
<% } %>
<% } %>
`;