3 Commits

Author SHA1 Message Date
simonecorsi
7fb87741a2 chore(release): 1.1.0-next.1 [skip ci]
# [1.1.0-next.1](https://github.com/simonecorsi/mawesome/compare/v1.0.45...v1.1.0-next.1) (2022-04-13)

### Bug Fixes

* pre-tags ([602befc](602befcb54))

### Features

* **template:** adds templates ([791de9a](791de9ab50)), closes [#14](https://github.com/simonecorsi/mawesome/issues/14)
2022-04-13 13:54:00 +00:00
Simone Corsi
602befcb54 fix: pre-tags 2022-04-13 15:51:20 +02:00
Simone Corsi
791de9ab50 feat(template): adds templates
if an `TEMPLATE.ejs` file is found in the repo it will be used for rendering

closes #14
2022-04-13 15:34:08 +02:00
4 changed files with 45 additions and 29 deletions

View File

@@ -1,35 +1,36 @@
# [1.1.0-next.1](https://github.com/simonecorsi/mawesome/compare/v1.0.45...v1.1.0-next.1) (2022-04-13)
### Bug Fixes
* pre-tags ([602befc](https://github.com/simonecorsi/mawesome/commit/602befcb5494b5bfd74d2333899311b81ea9da6d))
### Features
* **template:** adds templates ([791de9a](https://github.com/simonecorsi/mawesome/commit/791de9ab504de50e2e9cb031b9e373d7cc0589c0)), closes [#14](https://github.com/simonecorsi/mawesome/issues/14)
## <small>1.0.45 (2022-01-17)</small>
* build(deps): bump shelljs from 0.8.4 to 0.8.5 ([1da350a](https://github.com/simonecorsi/mawesome/commit/1da350a))
- build(deps): bump shelljs from 0.8.4 to 0.8.5 ([1da350a](https://github.com/simonecorsi/mawesome/commit/1da350a))
## <small>1.0.44 (2021-10-26)</small>
* chore(release): v1.0.44 ([6ffe17f](https://github.com/simonecorsi/mawesome/commit/6ffe17f))
* feat: git add multiple files at once ([4aef61f](https://github.com/simonecorsi/mawesome/commit/4aef61f))
- chore(release): v1.0.44 ([6ffe17f](https://github.com/simonecorsi/mawesome/commit/6ffe17f))
- feat: git add multiple files at once ([4aef61f](https://github.com/simonecorsi/mawesome/commit/4aef61f))
## <small>1.0.43 (2021-10-15)</small>
* chore(release): v1.0.43 ([5e0ef82](https://github.com/simonecorsi/mawesome/commit/5e0ef82))
* feat: reduce json output size ([94635fe](https://github.com/simonecorsi/mawesome/commit/94635fe))
- chore(release): v1.0.43 ([5e0ef82](https://github.com/simonecorsi/mawesome/commit/5e0ef82))
- feat: reduce json output size ([94635fe](https://github.com/simonecorsi/mawesome/commit/94635fe))
## <small>1.0.42 (2021-10-14)</small>
* chore(release): v1.0.42 ([5b36813](https://github.com/simonecorsi/mawesome/commit/5b36813))
* fix(paginator): last page now correctly matches rex ([dcf9898](https://github.com/simonecorsi/mawesome/commit/dcf9898))
- chore(release): v1.0.42 ([5b36813](https://github.com/simonecorsi/mawesome/commit/5b36813))
- fix(paginator): last page now correctly matches rex ([dcf9898](https://github.com/simonecorsi/mawesome/commit/dcf9898))
## <small>1.0.41 (2021-10-14)</small>
* chore(release): v1.0.41 ([884fc90](https://github.com/simonecorsi/mawesome/commit/884fc90))
* test: fixs suite ([b97833f](https://github.com/simonecorsi/mawesome/commit/b97833f))
* fix: should avoid index lock ([1d6848c](https://github.com/simonecorsi/mawesome/commit/1d6848c))
- chore(release): v1.0.41 ([884fc90](https://github.com/simonecorsi/mawesome/commit/884fc90))
- test: fixs suite ([b97833f](https://github.com/simonecorsi/mawesome/commit/b97833f))
- fix: should avoid index lock ([1d6848c](https://github.com/simonecorsi/mawesome/commit/1d6848c))

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "mawesome",
"version": "1.0.45",
"version": "1.1.0-next.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mawesome",
"version": "1.0.45",
"version": "1.1.0-next.1",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.6",

View File

@@ -1,6 +1,6 @@
{
"name": "mawesome",
"version": "1.0.45",
"version": "1.1.0-next.1",
"description": "Generate awesome list from user starred repositories",
"main": "index.js",
"author": "Simone Corsi<simonecorsi.dev@gmail.com>",

View File

@@ -1,4 +1,5 @@
import * as core from '@actions/core';
import { readdir, readFile } from 'fs/promises';
import {
renderer,
@@ -27,11 +28,25 @@ export async function main(): Promise<any> {
{}
);
const rendered = await renderer({
username: REPO_USERNAME,
stars: Object.entries(sortedByLanguages),
updatedAt: Date.now(),
});
// get template if found in the repo
let template;
try {
const dir = await readdir('./');
core.info(dir.join('\n'));
template = await readFile('TEMPLATE.ejs', 'utf8');
core.info(template);
} catch {
core.warning("Couldn't find template file, using default");
}
const rendered = await renderer(
{
username: REPO_USERNAME,
stars: Object.entries(sortedByLanguages),
updatedAt: Date.now(),
},
template
);
const markdown: string = await generateMd(rendered);