Skip to content

Commit 07b8108

Browse files
committed
chore: issues filter
1 parent b660c6b commit 07b8108

File tree

6 files changed

+45
-10
lines changed

6 files changed

+45
-10
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
node-version: '14'
1919
- run: yarn
20-
- run: yarn posts --token=${{ secrets.GG_TOKEN }} --owner=${{ secrets.GG_USER }} --repo=${{ secrets.GG_REPO }} --issues-owner=${{ secrets.GG_ISSUES_USER }} --issues-repo=${{ secrets.GG_ISSUES_REPO }} --type=${{ secrets.GG_TYPE }}
20+
- run: yarn posts:ci --token=${{ secrets.GG_TOKEN }} --owner=${{ secrets.GG_USER }} --repo=${{ secrets.GG_REPO }} --issues-owner=${{ secrets.GG_ISSUES_USER }} --issues-repo=${{ secrets.GG_ISSUES_REPO }} --type=${{ secrets.GG_TYPE }} --issues-state=${{ secrets.GG_ISSUES_STATE }}
2121
- run: yarn reconf
2222
- run: yarn build
2323
- run: yarn copy

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"keywords": [
88
"github",
99
"discussions",
10+
"issues",
1011
"gatsby",
1112
"pwa",
1213
"website",
@@ -19,7 +20,9 @@
1920
"clean": "gatsby clean",
2021
"rgd": "rgd",
2122
"deploy": "node ./scripts/deploy",
22-
"posts": "rgd --mode=json,rss --jsonfmt=true --outdir=discussions",
23+
"posts:base": "rgd --mode=json,rss --jsonfmt=true --outdir=discussions",
24+
"posts:ci": "yarn posts:base",
25+
"posts": "yarn posts:base",
2326
"reconf": "node ./scripts/reconf",
2427
"reset": "node ./scripts/reset",
2528
"copy": "node ./scripts/copy"
@@ -50,6 +53,6 @@
5053
},
5154
"devDependencies": {
5255
"@types/body-scroll-lock": "^3.1.0",
53-
"rgd": "^2.0.2"
56+
"rgd": "^2.0.4"
5457
}
55-
}
58+
}

scripts/reconf.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ function cnameUpdate() {
101101
function pkgUpdate() {
102102
pkg.name = rgdConf.repo;
103103
pkg.description = rgdConf.description || rgdConf.website?.description;
104+
if (rgdConf.type === 'issues') {
105+
pkg.scripts.posts = `yarn post:base --owner=${rgdConf.owner} --repo=${rgdConf.repo} --issues-owner=${rgdConf['issues-owner']} --issues-repo=${rgdConf['issues-repo']} --type=${rgdConf.type} --issues-state=${rgdConf['issues-state']}`;
106+
} else {
107+
pkg.scripts.posts = `yarn post:base --owner=${rgdConf.owner} --repo=${rgdConf.repo}`;
108+
}
104109

105110
fs.writeFile('package.json', JSON.stringify(pkg, null, 2), (err) => {
106111
if (err) return;

src/utils/emoji.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,30 @@ const emojiMap: Record<string, string> = {
3838
game_die: '🎲'
3939
}
4040

41-
export default (emoji: string): string => emojiMap[emoji.slice(1, -1)] || '';
41+
export default (emoji: string): string => emojiMap[emoji.slice(1, -1)] || '';
42+
43+
44+
// -----------------------------------------
45+
// THUMBS_UP
46+
// Represents the :+1: emoji.
47+
48+
// THUMBS_DOWN
49+
// Represents the :-1: emoji.
50+
51+
// LAUGH
52+
// Represents the :laugh: emoji.
53+
54+
// HOORAY
55+
// Represents the :hooray: emoji.
56+
57+
// CONFUSED
58+
// Represents the :confused: emoji.
59+
60+
// HEART
61+
// Represents the :heart: emoji.
62+
63+
// ROCKET
64+
// Represents the :rocket: emoji.
65+
66+
// EYES
67+
// Represents the :eyes: emoji.

src/utils/tools.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export const fmtLabelsCategory = (list: any[], category: string[], level: string
1616
let re = reLevel(level);
1717
let obj: any = {};
1818
list.forEach((i: any) => {
19-
const key: any = intersection(category, i.labels.map((j: any) => j.name));
19+
const key: any = intersection(category, i.labels.map((j: any) => j.name))?.[0];
20+
2021
if (key) {
2122
if (!obj[key]) obj[key] = { level: [], list: [] };
2223

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8341,10 +8341,10 @@ [email protected]:
83418341
convert-source-map "^0.3.3"
83428342
css "^2.0.0"
83438343

8344-
rgd@^2.0.2:
8345-
version "2.0.2"
8346-
resolved "https://registry.npmmirror.com/rgd/-/rgd-2.0.2.tgz#5a7bb391a809acbe9934937bd916130e5f2f6c41"
8347-
integrity sha512-ebvcSx65hJEjjs/5E53Uh5T9FQCiIUljP/x7hYQOKIe5DAUupZQDqhFvzOIjZd+S/qFnXtvV+MH7Ds3SnOLx3g==
8344+
rgd@^2.0.4:
8345+
version "2.0.4"
8346+
resolved "https://registry.npmmirror.com/rgd/-/rgd-2.0.4.tgz#4d95736141bf2a54d8ea7e6687d856767621ce68"
8347+
integrity sha512-Pz6nxEIhDTT5eQ8LXcUxBeP1o1Ma9iQNEjj+raXMH4G1Wktb5Ryjv1AlQ5qR63TrLQw6HgGQJuwee4L8heL6iA==
83488348
dependencies:
83498349
"@octokit/graphql" "^4.6.4"
83508350
chalk "^4.1.1"

0 commit comments

Comments
 (0)