1 Commits

Author SHA1 Message Date
simonecorsi
97820aeb9c chore(release): 2.2.0-next.1 [skip ci]
# [2.2.0-next.1](https://github.com/simonecorsi/mawesome/compare/v2.1.0...v2.2.0-next.1) (2022-07-06)

### Features

* adds compacted by topics ([9dfa1f3](9dfa1f3dae))
2022-07-06 08:14:02 +00:00
11 changed files with 32283 additions and 42348 deletions

View File

@@ -1,39 +0,0 @@
name: Dependabot auto-merge
on: pull_request_target
jobs:
check:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
persist-credentials: false
- name: Install dependencies
run: npm i
- name: Build
run: npm run build
dependabot:
needs: [check]
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
with:
github-token: '${{ secrets.GH_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GH_TOKEN }}

View File

@@ -6,10 +6,10 @@ jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
- uses: actions/checkout@v4 - uses: actions/checkout@v3
with: with:
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
persist-credentials: false persist-credentials: false
@@ -21,7 +21,7 @@ jobs:
run: npm run build run: npm run build
- name: Semantic release - name: Semantic release
uses: codfish/semantic-release-action@v3 uses: codfish/semantic-release-action@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_AUTHOR_NAME: '${{ github.actor }}' GIT_AUTHOR_NAME: '${{ github.actor }}'

View File

@@ -22,8 +22,8 @@
[ [
"@saithodev/semantic-release-backmerge", "@saithodev/semantic-release-backmerge",
{ {
"backmergeBranches": [{ "from": "main", "to": "next" }], "branches": [{ "from": "main", "to": "next" }],
"clearWorkspace": true "backmergeStrategy": "rebase"
} }
] ]
] ]

View File

@@ -1,16 +1,8 @@
# [2.2.0](https://github.com/simonecorsi/mawesome/compare/v2.1.0...v2.2.0) (2022-07-06) # [2.2.0-next.1](https://github.com/simonecorsi/mawesome/compare/v2.1.0...v2.2.0-next.1) (2022-07-06)
### Bug Fixes
* compact by topic check ([49f6687](https://github.com/simonecorsi/mawesome/commit/49f66875e34ef186f183e370979ef751694d08b2))
* compact by topic check ([01cfb39](https://github.com/simonecorsi/mawesome/commit/01cfb39a41a2f60c709fd6dd6a46073149d96c20))
* docs ([4d7eef0](https://github.com/simonecorsi/mawesome/commit/4d7eef0991d896027ac464a40edfc564ced6bdd2))
### Features ### Features
* adds compacted by topics ([30fa351](https://github.com/simonecorsi/mawesome/commit/30fa351b37a04357303f59c79a90f92219f8072c))
* adds compacted by topics ([9dfa1f3](https://github.com/simonecorsi/mawesome/commit/9dfa1f3dae6c69033c682211c0e6bd9dc5a81eaf)) * adds compacted by topics ([9dfa1f3](https://github.com/simonecorsi/mawesome/commit/9dfa1f3dae6c69033c682211c0e6bd9dc5a81eaf))
# [2.1.0](https://github.com/simonecorsi/mawesome/compare/v2.0.0...v2.1.0) (2022-05-11) # [2.1.0](https://github.com/simonecorsi/mawesome/compare/v2.0.0...v2.1.0) (2022-05-11)

View File

@@ -12,7 +12,6 @@ You can see an example of the output at my own [simonecorsi/awesome](https://git
- [Requirements](#requirements) - [Requirements](#requirements)
- [Configuration](#configuration) - [Configuration](#configuration)
- [`api-token`](#api-token) - [`api-token`](#api-token)
- [`compact-by-topic`](#compact-by-topic)
- [`template-path`](#template-path) - [`template-path`](#template-path)
- [Example workflow](#example-workflow) - [Example workflow](#example-workflow)
@@ -29,14 +28,13 @@ You can see an example of the output at my own [simonecorsi/awesome](https://git
The service can be configured setting the appropriate environment variables or writing an `.env` file. The service can be configured setting the appropriate environment variables or writing an `.env` file.
| Variable | Description | Default | | Variable | Description | Default |
| ------------------ | ------------------------------------------------------------------- | -------------------------------- | | ----------------- | ------------------------------------------------------------------- | -------------------------------- |
| `api-token` | Personal Token is used to avoid rate limit, [read more](#api-token) | `${{ secrets.API_TOKEN }}` | | `api-token` | Personal Token is used to avoid rate limit, [read more](#api-token) | `${{ secrets.API_TOKEN }}` |
| `compact-by-topic` | Render another list in `TOPICS.md` compacted by github topics | `'false'` | | `github-name` | Name used for the commit | Github Action |
| `github-name` | Name used for the commit | Github Action | | `github-email` | email used for commit | actions@users.noreply.github.com |
| `github-email` | email used for commit | actions@users.noreply.github.com | | `template-path` | Custom `README.md` template, [read more](#template-path) |
| `template-path` | Custom `README.md` template, [read more](#template-path) | | `output-filename` | Output filename | `README.md` |
| `output-filename` | Output filename | `README.md` |
#### `api-token` #### `api-token`
@@ -44,15 +42,11 @@ The Personal API Access Token is mandatory to fetch stars from the API without i
You'll have to generate a [personal api token](https://github.com/settings/tokens/new) and then add You'll have to generate a [personal api token](https://github.com/settings/tokens/new) and then add
#### `compact-by-topic`
If `compact-by-topic` is `'true'` it will generate another markdown file `TOPICS.md` whith all stars compacted by their github topics, be aware that this list will be bigger since data is duplicated.
#### `template-path` #### `template-path`
If you don't like the output (default example [here](./TEMPLATE.ejs) ), you can provide your custom template that will be rendered using [EJS](https://ejs.co/) template engine. If you don't like the output (default example [here](./TEMPLATE.ejs) ), you can provide your custom template that will be rendered using [EJS](https://ejs.co/) template engine.
**Path provided is relative to your current repository directory, if file is not found it will default.** Path provided is relative to your current repository directory, if file is not found it will default.
## Example workflow ## Example workflow

61325
index.js

File diff suppressed because one or more lines are too long

13151
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "mawesome", "name": "mawesome",
"version": "2.2.0", "version": "2.0.0-0",
"description": "Generate awesome list from user starred repositories", "description": "Generate awesome list from user starred repositories",
"main": "index.js", "main": "index.js",
"author": "Simone Corsi<simonecorsi.dev@gmail.com>", "author": "Simone Corsi<simonecorsi.dev@gmail.com>",
@@ -22,44 +22,44 @@
"javascript" "javascript"
], ],
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^18.6.1", "@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^18.6.2", "@commitlint/config-conventional": "^17.0.2",
"@octokit/rest": "^20.0.2", "@octokit/rest": "^18.12.0",
"@octokit/types": "^12.6.0", "@octokit/types": "^6.2.1",
"@saithodev/semantic-release-backmerge": "^4.0.1", "@saithodev/semantic-release-backmerge": "^2.1.2",
"@semantic-release/changelog": "^6.0.3", "@semantic-release/changelog": "^6.0.1",
"@semantic-release/commit-analyzer": "^11.1.0", "@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.2.6", "@semantic-release/github": "^8.0.4",
"@semantic-release/release-notes-generator": "^12.1.0", "@semantic-release/release-notes-generator": "^10.0.3",
"@types/ejs": "^3.1.5", "@types/ejs": "^3.1.1",
"@types/got": "^9.6.12", "@types/got": "^9.6.12",
"@types/node": "^20.11.28", "@types/node": "^17.0.41",
"@types/sinon": "^17.0.3", "@types/sinon": "^10.0.11",
"@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^6.21.0", "@typescript-eslint/parser": "^5.27.1",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.34.0",
"eslint": "^8.57.0", "eslint": "^8.17.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^4.0.0",
"husky": "^8.0.3", "husky": "^8.0.1",
"lint-staged": "^15.2.2", "lint-staged": "^13.0.1",
"markdown-toc": "^1.2.0", "markdown-toc": "^1.2.0",
"nyc": "^15.0.1", "nyc": "^15.0.1",
"prettier": "^3.2.5", "prettier": "^2.6.2",
"sinon": "^17.0.1", "sinon": "^14.0.0",
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"typescript": "^5.4.2" "typescript": "^4.7.3"
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/core": "^1.8.2",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"ejs": "^3.1.9", "ejs": "^3.1.8",
"gh-star-fetch": "^1.5.0", "gh-star-fetch": "^1.5.0",
"got": "^11.8.5", "got": "^11.8.1",
"remark": "^15.0.1", "remark": "^14.0.2",
"remark-toc": "^9.0.0" "remark-toc": "^8.0.1"
}, },
"volta": { "volta": {
"node": "16.14.2", "node": "16.14.2",

View File

@@ -97,7 +97,7 @@ class Git {
createTag = (tag: string) => this.exec(`tag -a ${tag} -m "${tag}"`); createTag = (tag: string) => this.exec(`tag -a ${tag} -m "${tag}"`);
async pushNewFiles(files: File[] = []): Promise<unknown> { async pushNewFiles(files: File[] = []): Promise<any> {
if (!files.length) return; if (!files.length) return;
await this.pull(); await this.pull();

View File

@@ -7,7 +7,7 @@ export const REPO_USERNAME = process.env.GITHUB_REPOSITORY?.split('/')[0];
export const API_STARRED_URL = `${process.env.GITHUB_API_URL}/users/${REPO_USERNAME}/starred`; export const API_STARRED_URL = `${process.env.GITHUB_API_URL}/users/${REPO_USERNAME}/starred`;
export async function renderer( export async function renderer(
data: { [key: string]: unknown }, data: { [key: string]: any },
templateString: string templateString: string
): Promise<string> { ): Promise<string> {
try { try {
@@ -26,9 +26,9 @@ export function generateMd(data: string): Promise<string> {
if (error) { if (error) {
core.error('#generateMd'); core.error('#generateMd');
core.error(error); core.error(error);
resolve(''); return resolve('');
} }
resolve(String(file)); return resolve(String(file));
}); });
}); });
} }

View File

@@ -60,7 +60,11 @@ export async function main() {
} }
); );
if (core.getInput('compact-by-topic') === 'true') { const shouldCompactByTopic =
!!core.getInput('compact-by-topic') ||
core.getInput('compact-by-topic') === 'true';
if (shouldCompactByTopic) {
const compactedByTopic = compactByTopic(results); const compactedByTopic = compactByTopic(results);
const byTopic = await renderer( const byTopic = await renderer(
{ {
@@ -87,7 +91,7 @@ export async function run(): Promise<void> {
} }
} }
const catchAll = (info: string) => { const catchAll = (info: any) => {
core.setFailed(`#catchAll: ${info}`); core.setFailed(`#catchAll: ${info}`);
core.error(info); core.error(info);
}; };