mirror of https://github.com/layui/layui
				
				
				
			chore: 新增 issue, release 工作流 (#1455)
* 新增 Security Policy * 新增 relaese 工作流 * 新增 issue 工作流 * 优化 issue 工作流,usage → discussion * 优化 issue 工作流,增加 resolved 状态关闭期限 * 优化 issue 标签工作流,丰富回复文案pull/1458/head
							parent
							
								
									ca96cd86c0
								
							
						
					
					
						commit
						91ca6143ad
					
				| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
name: Issue Close Require
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  schedule:
 | 
			
		||||
    - cron: "0 0 * * *"
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  issue-close-require:
 | 
			
		||||
    permissions:
 | 
			
		||||
      issues: write
 | 
			
		||||
      pull-requests: write
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: need reproduce
 | 
			
		||||
        uses: actions-cool/issues-helper@v3
 | 
			
		||||
        with:
 | 
			
		||||
          actions: 'close-issues'
 | 
			
		||||
          labels: 'need reproduce'
 | 
			
		||||
          inactive-day: 5
 | 
			
		||||
          body: |
 | 
			
		||||
            由于超过 5 天仍未收到相关重现,该 issue 已被自动关闭。
 | 
			
		||||
      - name: resolved
 | 
			
		||||
        uses: actions-cool/issues-helper@v3
 | 
			
		||||
        with:
 | 
			
		||||
          actions: 'close-issues'
 | 
			
		||||
          labels: 'resolved'
 | 
			
		||||
          inactive-day: 3
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,82 @@
 | 
			
		|||
name: Issue Labeled
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  issues:
 | 
			
		||||
    types: [labeled]
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  issue-labeled:
 | 
			
		||||
    permissions:
 | 
			
		||||
      issues: write
 | 
			
		||||
      pull-requests: write
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: bug
 | 
			
		||||
        if: github.event.label.name == 'bug'
 | 
			
		||||
        uses: actions-cool/issues-helper@v3
 | 
			
		||||
        with:
 | 
			
		||||
          actions: 'create-comment'
 | 
			
		||||
          token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          issue-number: ${{ github.event.issue.number }}
 | 
			
		||||
          body: |
 | 
			
		||||
            @${{ github.event.issue.user.login }} 你好。团队已初步确认该 Bug,我们将在后续版本进行详细的排查和修复,感谢您的积极反馈 👍
 | 
			
		||||
  
 | 
			
		||||
      - name: help wanted
 | 
			
		||||
        if: github.event.label.name == 'help wanted'
 | 
			
		||||
        uses: actions-cool/issues-helper@v3
 | 
			
		||||
        with:
 | 
			
		||||
          actions: 'create-comment'
 | 
			
		||||
          token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          body: |
 | 
			
		||||
            @${{ github.event.issue.user.login }}  很棒 👋
 | 
			
		||||
            我们有意愿采纳这项议题,欢迎您创建 [Pull Request](https://github.com/layui/layui/pulls) 来协助实现,若变更内容涉及到 API 新增和改动,除了提交核心代码外,还需包含:[文档](https://github.com/layui/layui/tree/main/docs)、测试用例等相关文件,以便我们更好地进行 Review。期待您的贡献!
 | 
			
		||||
 | 
			
		||||
      - name: invalid
 | 
			
		||||
        if: github.event.label.name == 'invalid'
 | 
			
		||||
        uses: actions-cool/issues-helper@v3
 | 
			
		||||
        with:
 | 
			
		||||
          actions: 'create-comment,close-issue'
 | 
			
		||||
          token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          body: |
 | 
			
		||||
            @${{ github.event.issue.user.login }} 你好,为了提升沟通效率,我们对 Issue 制定了规范要求,你的 Issue 因不符合规范而被自动关闭。
 | 
			
		||||
            建议您在下次创建 Issue 时,遵循表单模板规范填写。谢谢。
 | 
			
		||||
            > 相关延伸:👉 [**提问的智慧**](https://github.com/tvvocold/How-To-Ask-Questions-The-Smart-Way)
 | 
			
		||||
      
 | 
			
		||||
      - name: need reproduce
 | 
			
		||||
        if: github.event.label.name == 'need reproduce'
 | 
			
		||||
        uses: actions-cool/issues-helper@v3
 | 
			
		||||
        with:
 | 
			
		||||
          actions: 'create-comment'
 | 
			
		||||
          token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          body: |
 | 
			
		||||
            @${{ github.event.issue.user.login }} 您好,请提供一个最小化的重现,以便我们为您协助排查问题。良好的重现应当包括但不仅限于:
 | 
			
		||||
            - 产生问题的详细步骤
 | 
			
		||||
            - 与问题相关的完整代码
 | 
			
		||||
            - 在线 Demo (推荐通过 [stackblitz](https://stackblitz.com/) 或 [codepen](https://codepen.io/) 创建)
 | 
			
		||||
            > 相关延伸:👉 [为什么要提供最小化重现?](https://antfu.me/posts/why-reproductions-are-required-zh)
 | 
			
		||||
 | 
			
		||||
      - name: discussion
 | 
			
		||||
        if: github.event.label.name == 'discussion'
 | 
			
		||||
        uses: actions-cool/issues-helper@v3
 | 
			
		||||
        with:
 | 
			
		||||
          actions: 'create-comment,close-issue'
 | 
			
		||||
          token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          body: |
 | 
			
		||||
            @${{ github.event.issue.user.login }} 你好,Issue 一般只接受「Bug 报告」和「新功能请求」,而您的议题涉及到基础用法和功能疑惑等业务相关的讨论,这并不适合作为 Issue 讨论。建议您通过以下方式寻求解决方案:
 | 
			
		||||
            - 仔细查阅 Layui 官方文档:https://layui.dev
 | 
			
		||||
            - 搜索相关技术资料或咨询人工智能大模型
 | 
			
		||||
            - [Discussions](https://github.com/layui/layui/discussions)
 | 
			
		||||
            
 | 
			
		||||
      - name: unrelated
 | 
			
		||||
        if: github.event.label.name == 'unrelated'
 | 
			
		||||
        uses: actions-cool/issues-helper@v3
 | 
			
		||||
        with:
 | 
			
		||||
          actions: 'create-comment,close-issue'
 | 
			
		||||
          token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
          body: |
 | 
			
		||||
            @${{ github.event.issue.user.login }} 经过确认,您提出的问题与 Layui 不存在相关联。建议通过以下方式寻求解决方案:
 | 
			
		||||
            - 搜索相关技术资料或咨询人工智能大模型
 | 
			
		||||
            - [Discussions](https://github.com/layui/layui/discussions)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,82 @@
 | 
			
		|||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    tags:
 | 
			
		||||
      - 'v*'
 | 
			
		||||
 | 
			
		||||
name: Create Release
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    name: Create Release
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout code
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - name: Get the version
 | 
			
		||||
        id: get_version
 | 
			
		||||
        run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
 | 
			
		||||
 | 
			
		||||
      # 获取当前版本贡献者
 | 
			
		||||
      - name: Fetch Contributors
 | 
			
		||||
        id: contributors
 | 
			
		||||
        run: |
 | 
			
		||||
          USERNAME_LIST=""
 | 
			
		||||
 | 
			
		||||
          # 获取完整的提交历史
 | 
			
		||||
          git fetch --prune --unshallow
 | 
			
		||||
 | 
			
		||||
          # 按日期排序标签,获取上一个标签
 | 
			
		||||
          PREVIOUS_TAG=$(git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags | sed -n 2p)
 | 
			
		||||
          
 | 
			
		||||
          # 获取当前标签
 | 
			
		||||
          CURRENT_TAG=${GITHUB_REF#refs/tags/}
 | 
			
		||||
 | 
			
		||||
          echo "Previous Tag: $PREVIOUS_TAG"
 | 
			
		||||
          echo "Current Tag: $CURRENT_TAG"
 | 
			
		||||
          
 | 
			
		||||
          for COMMIT_SHA in $(git log ${PREVIOUS_TAG}...$CURRENT_TAG --pretty=format:"%H")
 | 
			
		||||
          do
 | 
			
		||||
            USER=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
 | 
			
		||||
                   https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/$COMMIT_SHA \
 | 
			
		||||
                   | jq -r '.author.login')
 | 
			
		||||
            if [ "$USER" != "null" ] && [ ! -z "$USER" ]; then
 | 
			
		||||
              USERNAME_LIST="$USERNAME_LIST @$USER"
 | 
			
		||||
            fi
 | 
			
		||||
          done
 | 
			
		||||
          USERNAME_LIST=$(echo $USERNAME_LIST | tr ' ' '\n' | sort -u | tr '\n' ' ')
 | 
			
		||||
          echo "usernames=$USERNAME_LIST" >> $GITHUB_OUTPUT
 | 
			
		||||
 | 
			
		||||
      - name: Determine Prerelease
 | 
			
		||||
        id: prerelease
 | 
			
		||||
        run: |
 | 
			
		||||
          if [[ ${{ github.ref }} =~ - ]]; then
 | 
			
		||||
            echo "Setting prerelease to true"
 | 
			
		||||
            echo "prerelease=true" >> $GITHUB_OUTPUT
 | 
			
		||||
          else
 | 
			
		||||
            echo "Setting prerelease to false"
 | 
			
		||||
            echo "prerelease=false" >> $GITHUB_OUTPUT
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
      - name: Create Zip File
 | 
			
		||||
        id: asset
 | 
			
		||||
        run: |
 | 
			
		||||
          DIR_NAME="layui-${{ env.VERSION }}"
 | 
			
		||||
          mkdir -p $DIR_NAME/layui
 | 
			
		||||
          mv dist layui
 | 
			
		||||
          mv layui $DIR_NAME/
 | 
			
		||||
          mv examples/introduce/* $DIR_NAME/
 | 
			
		||||
          zip -r $DIR_NAME.zip $DIR_NAME
 | 
			
		||||
          echo "filename=$DIR_NAME" >> $GITHUB_OUTPUT
 | 
			
		||||
            
 | 
			
		||||
      - name: GH Release
 | 
			
		||||
        id: create_release
 | 
			
		||||
        uses: softprops/action-gh-release@v0.1.15
 | 
			
		||||
        env:
 | 
			
		||||
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
        with:
 | 
			
		||||
          body: |
 | 
			
		||||
            - **更新日志**: https://layui.dev/docs/2/versions.html#${{ env.VERSION }}
 | 
			
		||||
            - **本次贡献**: ${{ steps.contributors.outputs.usernames }} 🎉
 | 
			
		||||
          prerelease: ${{ steps.prerelease.outputs.prerelease }}
 | 
			
		||||
          files: ${{ steps.asset.outputs.filename }}.zip
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
# Security Policy
 | 
			
		||||
 | 
			
		||||
## Supported Versions
 | 
			
		||||
 | 
			
		||||
Use this section to tell people about which versions of your project are
 | 
			
		||||
currently being supported with security updates.
 | 
			
		||||
 | 
			
		||||
| Version | Supported          |
 | 
			
		||||
| ------- | ------------------ |
 | 
			
		||||
| 2.9.x   | :white_check_mark: |
 | 
			
		||||
| 2.8.x   | :white_check_mark: |
 | 
			
		||||
| < 2.8.0   | :x:                |
 | 
			
		||||
 | 
			
		||||
## Reporting a Vulnerability
 | 
			
		||||
 | 
			
		||||
Use this section to tell people how to report a vulnerability.
 | 
			
		||||
 | 
			
		||||
Tell them where to go, how often they can expect to get an update on a
 | 
			
		||||
reported vulnerability, what to expect if the vulnerability is accepted or
 | 
			
		||||
declined, etc.
 | 
			
		||||
		Loading…
	
		Reference in New Issue