Skip to content

Commit ba273ff

Browse files
committed
[optimize] Article category & file path of GitHub issue forms & actions
[fix] GitHub CLI token in actions
1 parent a9bf14f commit ba273ff

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

.github/ISSUE_TEMPLATE/new-article.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@ body:
2323
attributes:
2424
label: 修订时间
2525
description: 格式为 YYYY-MM-DD hh:mm
26-
- type: input
27-
id: categories
26+
- type: dropdown
27+
id: category
2828
attributes:
2929
label: 分类
30-
description: 每级分类对应一级目录,写在本文件的文件名前面
31-
placeholder: 分类名应为一个首字母大写的英文单词,多个则用英文逗号隔开
30+
options:
31+
- Algorithm
32+
- Engineering
33+
- Propaganda
34+
- Summary
35+
- Theory
36+
- Translation
3237
validations:
3338
required: true
3439
- type: input

.github/ISSUE_TEMPLATE/translation.yml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: 文章翻译
22
description: 外文优秀技术、开源文章翻译
33
title: (译文中文标题)
44
labels:
5-
- Article
65
- Translation
76
projects:
87
- FreeCodeCamp-Chengdu/4

.github/workflows/save-activity.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ jobs:
2121

2222
- name: Generate Markdown file
2323
env:
24+
GH_TOKEN: ${{ github.token }}
2425
FILE_NAME: ${{ steps.issue-parser.outputs.issueparser_file_name }}
2526
CATEGORY: ${{ steps.issue-parser.outputs.issueparser_category }}
2627
TYPE: ${{ steps.issue-parser.outputs.issueparser_type }}
2728
PHOTOS: ${{ steps.issue-parser.outputs.issueparser_photos }}
2829
FILES: ${{ steps.issue-parser.outputs.issueparser_files }}
2930
run: |
30-
cat <<EOF > _posts/Activity/$CATEGORY/$FILE_NAME.md
31+
FILE_PATH=Activity/$CATEGORY/$FILE_NAME
32+
33+
cat <<EOF > _posts/$FILE_PATH.md
3134
---
3235
title: "${{ github.event.issue.title }}"
3336
date: ${{ steps.issue-parser.outputs.issueparser_date || github.event.issue.created_at }}
@@ -50,7 +53,7 @@ jobs:
5053
${{ steps.issue-parser.outputs.issueparser_content }}
5154
EOF
5255
53-
POST_URL=$(echo "https://fcc-cd.dev/activity/$CATEGORY/$FILE_NAME" | tr '[:upper:]' '[:lower:]')
56+
POST_URL=$(echo "https://fcc-cd.dev/$FILE_PATH" | tr '[:upper:]' '[:lower:]')
5457
5558
COMMENT_BODY="After the linked PR merged, the activity will be posted at: $POST_URL"
5659

.github/workflows/save-article.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@ jobs:
2121

2222
- name: Generate Markdown file
2323
env:
24+
GH_TOKEN: ${{ github.token }}
2425
FILE_NAME: ${{ steps.issue-parser.outputs.issueparser_file_name }}
25-
CATEGORIES: ${{ steps.issue-parser.outputs.issueparser_categories }}
26+
CATEGORY: ${{ steps.issue-parser.outputs.issueparser_category }}
2627
THUMBNAIL: ${{ steps.issue-parser.outputs.issueparser_thumbnail }}
2728
run: |
28-
FILE_PATH=$(echo $CATEGORIES | tr ',' '/')
29+
FILE_PATH=Article/$CATEGORY/$FILE_NAME
2930
30-
cat <<EOF > _posts/$FILE_PATH/$FILE_NAME.md
31+
cat <<EOF > _posts/$FILE_PATH.md
3132
---
3233
title: "${{ github.event.issue.title }}"
3334
date: ${{ steps.issue-parser.outputs.issueparser_date || github.event.issue.created_at }}
3435
updated: ${{ steps.issue-parser.outputs.issueparser_updated }}
35-
categories: [$CATEGORIES]
36+
categories: [Article, $CATEGORY]
3637
tags: [${{ steps.issue-parser.outputs.issueparser_tags }}]
3738
authors: [${{ steps.issue-parser.outputs.issueparser_authors }}]
3839
original: ${{ steps.issue-parser.outputs.issueparser_original }}
@@ -43,7 +44,7 @@ jobs:
4344
${{ steps.issue-parser.outputs.issueparser_content }}
4445
EOF
4546
46-
POST_URL=$(echo "https://fcc-cd.dev/$FILE_PATH/$FILE_NAME" | tr '[:upper:]' '[:lower:]')
47+
POST_URL=$(echo "https://fcc-cd.dev/$FILE_PATH" | tr '[:upper:]' '[:lower:]')
4748
4849
COMMENT_BODY="After the linked PR merged, the article will be posted at: $POST_URL"
4950

0 commit comments

Comments
 (0)