|
| 1 | +name: Generate Activity Markdown |
| 2 | +on: |
| 3 | + issues: |
| 4 | + types: |
| 5 | + - labeled |
| 6 | +jobs: |
| 7 | + generate-markdown: |
| 8 | + if: contains(github.event.issue.labels.*.name, 'Salon') || contains(github.event.issue.labels.*.name, 'Workshop') || contains(github.event.issue.labels.*.name, 'Conference') |
| 9 | + runs-on: ubuntu-latest |
| 10 | + permissions: |
| 11 | + pull-requests: write |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - id: issue-parser |
| 16 | + uses: stefanbuck/github-issue-parser@v3 |
| 17 | + with: |
| 18 | + template-path: ".github/ISSUE_TEMPLATE/new_activity.yml" |
| 19 | + |
| 20 | + - name: Generate Markdown file |
| 21 | + env: |
| 22 | + CATEGORY: ${{ steps.issue-parser.outputs.issueparser_category }} |
| 23 | + TYPE: ${{ steps.issue-parser.outputs.issueparser_type }} |
| 24 | + run: | |
| 25 | + cat <<EOF > _posts/Activity/$CATEGORY/${{ steps.issue-parser.outputs.issueparser_file_name }}.md |
| 26 | + --- |
| 27 | + title: "${{ github.event.issue.title }}" |
| 28 | + date: ${{ steps.issue-parser.outputs.issueparser_date || github.event.issue.created_at }} |
| 29 | + categories: [Activity, $CATEGORY] |
| 30 | + tags: [$TYPE, ${{ steps.issue-parser.outputs.issueparser_tags }}] |
| 31 | + toc: true |
| 32 | + description: "${{ steps.issue-parser.outputs.issueparser_description }}" |
| 33 | + start: ${{ steps.issue-parser.outputs.issueparser_start }} |
| 34 | + end: ${{ steps.issue-parser.outputs.issueparser_end }} |
| 35 | + address: "${{ steps.issue-parser.outputs.issueparser_address }}" |
| 36 | + links: |
| 37 | + 报名: ${{ steps.issue-parser.outputs.issueparser_links }} |
| 38 | + mentors: [${{ steps.issue-parser.outputs.issueparser_mentors }}] |
| 39 | + workers: [${{ steps.issue-parser.outputs.issueparser_workers }}] |
| 40 | + partners: [${{ steps.issue-parser.outputs.issueparser_partners }}] |
| 41 | + photos: [${{ steps.issue-parser.outputs.issueparser_photos }}] |
| 42 | + files: [${{ steps.issue-parser.outputs.issueparser_files }}] |
| 43 | + --- |
| 44 | +
|
| 45 | + ${{ steps.issue-parser.outputs.issueparser_content }} |
| 46 | + EOF |
| 47 | +
|
| 48 | + - uses: peter-evans/create-pull-request@v6 |
| 49 | + with: |
| 50 | + title: "[add] ${{ github.event.issue.title }} activity" |
| 51 | + body: "closes #${{ github.event.issue.number }}" |
0 commit comments