Skip to content

Commit

Permalink
[fix] Activity issue label, project & file URI
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery committed Feb 24, 2025
1 parent 4aa9f11 commit 1a49d79
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ description: 自动生成新活动的 pull request
title: 【新活动】(替换此处为活动主题)
labels:
- Activity
projects:
- FreeCodeCamp-Chengdu/5
assignees:
- TechQuery
body:
Expand Down Expand Up @@ -35,6 +37,7 @@ body:
options:
- online
- offline
multiple: true
validations:
required: true
- type: input
Expand Down Expand Up @@ -93,6 +96,7 @@ body:
id: partners
attributes:
label: 合办方、场地方、赞助方
description: 合作方 ID 详见:https://github.com/FreeCodeCamp-Chengdu/Wiki/tree/master/_posts/Partner
placeholder: 多个则用英文逗号隔开
- type: textarea
id: photos
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: (译文中文标题)
labels:
- Article
- Translation
projects:
- FreeCodeCamp-Chengdu/4
body:
- type: input
id: page_link
Expand Down
4 changes: 4 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ labels:
color: "#d73a4a"
description: auto download an Outer Article to translate

- name: Activity
color: "#f9d0c4"
description: 活动一级分类

- name: Salon
color: "#d7f797"
description: 小型分享会、讲座
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/save-activity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@ on:
- labeled
jobs:
generate-markdown:
if: contains(github.event.issue.labels.*.name, 'Salon') || contains(github.event.issue.labels.*.name, 'Workshop') || contains(github.event.issue.labels.*.name, 'Conference')
if: contains(github.event.issue.labels.*.name, 'Activity')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- id: issue-parser
uses: stefanbuck/github-issue-parser@v3
with:
template-path: ".github/ISSUE_TEMPLATE/new_activity.yml"
template-path: ".github/ISSUE_TEMPLATE/new-activity.yml"

- name: Generate Markdown file
env:
CATEGORY: ${{ steps.issue-parser.outputs.issueparser_category }}
TYPE: ${{ steps.issue-parser.outputs.issueparser_type }}
PHOTOS: ${{ steps.issue-parser.outputs.issueparser_photos }}
FILES: ${{ steps.issue-parser.outputs.issueparser_files }}
run: |
cat <<EOF > _posts/Activity/$CATEGORY/${{ steps.issue-parser.outputs.issueparser_file_name }}.md
---
Expand All @@ -34,18 +37,18 @@ jobs:
end: ${{ steps.issue-parser.outputs.issueparser_end }}
address: "${{ steps.issue-parser.outputs.issueparser_address }}"
links:
报名: ${{ steps.issue-parser.outputs.issueparser_links }}
报名: ${{ steps.issue-parser.outputs.issueparser_register_link }}
mentors: [${{ steps.issue-parser.outputs.issueparser_mentors }}]
workers: [${{ steps.issue-parser.outputs.issueparser_workers }}]
partners: [${{ steps.issue-parser.outputs.issueparser_partners }}]
photos: [${{ steps.issue-parser.outputs.issueparser_photos }}]
files: [${{ steps.issue-parser.outputs.issueparser_files }}]
photos: [$(echo $PHOTOS | grep -oE 'https?://[^ \)]+' | tr '\n' ',' | sed 's/,$//')]
files: [$(echo $FILES | grep -oE 'https?://[^ \)]+' | tr '\n' ',' | sed 's/,$//')]
---
${{ steps.issue-parser.outputs.issueparser_content }}
EOF
- uses: peter-evans/create-pull-request@v6
- uses: peter-evans/create-pull-request@v7
with:
title: "[add] ${{ github.event.issue.title }} activity"
body: "closes #${{ github.event.issue.number }}"
8 changes: 5 additions & 3 deletions .github/workflows/save-article.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ jobs:
if: contains(github.event.issue.labels.*.name, 'Article')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- id: issue-parser
uses: stefanbuck/github-issue-parser@v3
with:
template-path: ".github/ISSUE_TEMPLATE/new_article.yml"
template-path: ".github/ISSUE_TEMPLATE/new-article.yml"

- name: Generate Markdown file
env:
CATEGORIES: ${{ steps.issue-parser.outputs.issueparser_categories }}
THUMBNAIL: ${{ steps.issue-parser.outputs.issueparser_thumbnail }}
run: |
cat <<EOF > _posts/$(echo $CATEGORIES | tr ',' '/')/${{ steps.issue-parser.outputs.issueparser_file_name }}.md
---
Expand All @@ -31,13 +33,13 @@ jobs:
authors: [${{ steps.issue-parser.outputs.issueparser_authors }}]
original: ${{ steps.issue-parser.outputs.issueparser_original }}
toc: true
thumbnail: ${{ steps.issue-parser.outputs.issueparser_thumbnail }}
thumbnail: $(echo $THUMBNAIL | grep -oE 'https?://[^ \)]+' | head -n 1)
---
${{ steps.issue-parser.outputs.issueparser_content }}
EOF
- uses: peter-evans/create-pull-request@v6
- uses: peter-evans/create-pull-request@v7
with:
title: "[add] ${{ github.event.issue.title }} article"
body: "closes #${{ github.event.issue.number }}"

0 comments on commit 1a49d79

Please sign in to comment.