Skip to content

Closed 外部Issue#609 #20

Closed 外部Issue#609

Closed 外部Issue#609 #20

Workflow file for this run

# concurrency就是控制并发的,流水线运行后会自动加锁
# 在一个组的流水线任务只能有一个在运行,其他流水线任务会被pedding
# 文档:https://docs.github.com/zh/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
concurrency:
group: archiving-group
name: Auto issues archiving
run-name: "Closed 外部Issue#${{ github.event.issue.number }}${{ github.event.inputs.issue_number }}"
# permissions是关于GITHUB_TOKEN权限的,内容详见:
# https://docs.github.com/zh/actions/writing-workflows/workflow-syntax-for-github-actions#permissions
permissions:
issues: write
contents: write
on:
issues:
types: [closed]
workflow_dispatch:
inputs:
issue_number:
description: Issue单号:
required: true
issue_title:
description: Issue标题:
required: false
default: ""
introduced_version:
description: 引入版本号:
required: false
default: ""
archive_version:
description: 归档版本号:
required: false
default: ""
issue_type:
description: Issue类型:
required: false
default: "自动判断"
type: choice
options:
- 自动判断
- Bug修复
- 设定引入
- 设定调整
env:
ARCHIVED_DOCUMENT_PATH: "./修改归档.md"
TARGET_BRANCH: master
ISSUE_OUTPUT_PATH: "./issue_info.json"
ISSUE_REPOSITORY: "外部Issue"
COMMIT_TITLE: "Closed 外部Issue#"
TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_EVENT_TYPE: ${{ github.event_name }}
# 具体有什么事件类型:https://docs.github.com/zh/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#about-events-that-trigger-workflows
ISSUE_NUMBER: ${{ github.event.issue.number }}
MANUAL_ISSUE_NUMBER: ${{ github.event.inputs.issue_number }}
jobs:
auto_archiving:
name: "Closed 外部Issue#${{ github.event.issue.number }}${{ github.event.inputs.issue_number }}"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python and install dependencies
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
- run: |
pip install -r ./rn_issues_auto_archiving/issue_processor/requirements.txt
pip install -r ./rn_issues_auto_archiving/auto_archiving/requirements.txt
- name: Processing issue content
env:
# 自动流水线变量
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_STATE: ${{ github.event.issue.state }}
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_URL: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}"
COMMENTS_URL: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"
# 手动流水线变量
MANUAL_ISSUE_TITLE: ${{ github.event.inputs.issue_title }}
MANUAL_ISSUE_STATE: "open"
ARCHIVE_VERSION: ${{ github.event.inputs.archive_version }}
INTRODUCED_VERSION: ${{ github.event.inputs.introduced_version }}
ISSUE_TYPE: ${{ github.event.inputs.issue_type }}
MANUAL_ISSUE_URL: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.inputs.issue_number }}"
MANUAL_COMMENTS_URL: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.inputs.issue_number }}/comments"
run: |
python ./rn_issues_auto_archiving/main.py --config "./config/auto_archiving.json"
- name: Add and commit changes
run: |
bash ./rn_issues_auto_archiving/push_document.sh
- name: Send archiving success comment
run: |
python ./rn_issues_auto_archiving/archiving_success.py