ITADN
ScoopInstaller/GithubActions
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈

Scoop 桶的 Github Actions

一组自动化操作,供 issue / pull request 的维护者使用,以节省管理 issue / pull request 的时间。

可用的环境变量

  1. GITHUB_TOKEN
    • REQUIRED
    • Use ${{ secrets.GITHUB_TOKEN }}
  2. USER_EMAIL
    • String
    • Optional
  3. SCOOP_REPO
    • String
    • If specified, scoop config 'scoop_repo' will be configured and scoop updated
  4. SCOOP_BRANCH
    • String
    • If specified, scoop config 'scoop_branch' will be configured and scoop updated
  5. SKIP_UPDATED
    • String. Use '1' or '0'
    • If enabled, log of checkver utility will not print latest versions
  6. THROW_ERROR
    • String. Use '1' or '0'
    • If enabled, error from checkver utility will be thrown as exception and cause the run to fail
  7. SPECIAL_SNOWFLAKES
    • String
    • List of manifest names joined with , used as parameter for auto-pr utility.

可用操作

挖掘机

问题

当新 issue 被创建 或 issue 上 添加了标签 verify 时,该 action 会被执行。 根据 issue 标题,会执行一个特定的子 action。 它可能是以下之一:

  • Hash check fails
    1. Checkhashes binary is executed for manifest in title
    2. Result is parsed
      1. Hash mismatch
        1. Pull requests with name <manifest>@<version>: Fix hash are listed
          1. There is PR already
            1. The newest one is selected
            2. Description of this PR is updated with closing directive for created issue
            3. Comment to issue is posted with reference to PR
            4. Label duplicate added
          2. If none
            1. New branch <manifest>-hash-fix-<random> is created
            2. Changes are commited
            3. New PR is created from this branch
        2. Labels hash-fix-needed, verified are added
      2. No problem
        1. Comment on issue is posted about hashes being right and possible causes
        2. Label hash-fix-needed is removed
        3. Issue is closed
      3. Binary error
        1. Label manifest-fix-needed is added
  • Download failed
    1. All urls defined in manifest are retrieved
    2. Downloading of all urls is executed
    3. Comment to issue is posted
      1. If there is problematic URL
        1. List of these URLs is attached in comment
        2. Labels manifest-fix-needed, verified, help wanted are added
      2. All URLs could be downloaded without problem
        1. Possible causes are attached in comment
  • Decompression/Extraction error
    1. Comment to issue is posted
  1. 如果问题描述中提及了一个或多个特定的提取工具名称(7zip|msi|innounp|dark) 1. 仅会在评论中添加相关的提取帮助提示 1. 问题描述中未提及任何特定的提取工具名称 1. 所有提取帮助提示都会添加在评论中

Pull Requests

一旦 PR 被创建/verify 开头的评论 被发布,验证测试将会执行(详见 wiki 获取详细说明):

验证器概述

  1. JSON 标准格式检查
  2. 必需属性(LicenseDescription)已就位
  3. 文件哈希值正确
  4. Checkver 功能
  5. Autoupdate 功能
    1. 哈希提取完成

所有操作的示例工作流

  • 名称可按需更改
  • if 语句不是必需的
    • 在查找合适的操作日志时,它们只是节省时间的工具
    • 节省 GitHub 资源
#.github\workflows\schedule.yml
on:
  schedule:
  - cron: '*/30 * * * *'
name: Excavator
jobs:
  excavate:
    name: Excavator
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    - name: Excavator
      uses: ScoopInstaller/GithubActions@main
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        SKIP_UPDATED: '1'

#.github\workflows\issues.yml
on:
  issues:
    types: [ opened, labeled ]
name: Issue
jobs:
  issueHandler:
    name: Issue Handler
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    - name: Issue Handler
      uses: ScoopInstaller/GithubActions@main
      if: github.event.action == 'opened' || (github.event.action == 'labeled' && contains(github.event.issue.labels.*.name, 'verify'))
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

#.github\workflows\issue_commented.yml
on:
  issue_comment:
    types: [ created ]
name: Commented Pull Request
jobs:
  pullRequestHandler:
    name: Pull Request Validator
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    - name: Pull Request Validator
      uses: ScoopInstaller/GithubActions@main
      if: startsWith(github.event.comment.body, '/verify')
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

#.github\workflows\pull_request.yml
on:
  pull_request:
    types: [ opened ]
name: Pull Requests
jobs:
  pullRequestHandler:
    name: Pull Request Validator
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    - name: Pull Request Validator
      uses: ScoopInstaller/GithubActions@main
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

许可证

该项目以 MIT 许可证发布。