Skip to content

chinese - [zh](freeCodeCamp 在圣诞节发布课程重大更新) #263

chinese - [zh](freeCodeCamp 在圣诞节发布课程重大更新)

chinese - [zh](freeCodeCamp 在圣诞节发布课程重大更新) #263

name: Articles auto translate
run-name: ${{ github.event.label.name }} - ${{ github.event.issue.title }}
on:
issues:
types:
- labeled
jobs:
ArticlesAutoTranslate:
runs-on: ubuntu-latest
env:
ACTIONS_RUNNER_DEBUG: true
permissions:
issues: write
contents: write
# Check if the label is 'auto'. If not, skip the entire job.
if: ${{ github.event.label.name == 'auto' }}
steps:
# Check if the issue body is empty. If so, exit the action.
- name: Check if the description of the issue is empty
if: ${{ !github.event.issue.body }}
shell: bash
run: echo "The description of the issue is empty." 1>&2; exit 1;
- uses: actions/checkout@v3
- name: Crawl pages and generate Markdown files
id: fetch-webpage-to-markdown
continue-on-error: true
uses: freeCodeCamp/article-webpage-to-markdown-action@dev
with:
newsLink: '${{ github.event.issue.Body }}'
includeSelector: 'span.author-card-name,section.post-content'
ignoreSelector: '.ad-wrapper'
skipSameArticleCheck: true
skipIssueComment: true
markDownFilePath: './articles/_tmp/'
githubToken: '${{ github.token }}'
- name: Articles auto translate
uses: freeCodeCamp/articles-auto-translate-action@main
with:
with_issue_title: '${{ github.event.issue.title }}'
with_issue_body: '${{ github.event.issue.Body }}'
with_label_name: '${{ github.event.label.name }}'
with_github_token: '${{ github.token }}'
with_orginal_markdown_file_path: ${{ steps.fetch-webpage-to-markdown.outputs.markdown_file_path }}
with_task_fetch_to_save_path: './articles/_raw/'
with_task_fetch_to_include_selector: '.author-card-name,.post-content'
with_task_fetch_to_ignore_selector: '.ad-wrapper'
with_task_translate_openai_api_key: ${{ secrets.OPENAI_API_KEY }}
with_task_translate_to_save_path: './articles/{lang}/'
# Commit the local changes
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: '${{ github.event.issue.title }}'
file_pattern: articles/**/*.md
commit_user_name: PageToMarkdown Bot
commit_user_email: PageToMarkdown-bot@freeCodeCamp.org