Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

feat(action): need a custom action for `commitlint`

未关闭
#12 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@aRustyDev 已经在做这个了。

开始于 2026年1月19日。

评估

这个 Issue 还没有评估数据。

描述

Goals

  • checks if PR titles conform commitlint header
  • checks if PR body conforms to commitlint body
  • If it's run as a result of a pull request, it lints all the commits from the pull request (up to 250). If it's run as the result of a push, it lints all the commits in that branch. Otherwise, it lints all the commits on the default branch
    • based on the action event_name.
      • push: The last commit; from HEAD~1 to HEAD
      • pull_request: from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} to ${{ github.event.pull_request.head.sha }}
  • configure your GitHub repository to use the squash & merge strategy and tick the option "Default to PR title for squash merge commits".
  • filter by author
  • exclude merged commits
  • commitDepth: limits to N most recent
  • Check best practices:
    • Enable "Require linear history" in branch protection rules
    • Enable "Require signed commits" in branch protection rules
    • Enable "Require signed web commits" in branch protection rules
{
  "LABEL": {
    "name": "title/description needs formatting",
    "color": "EEEEEE"
  },
  "CHECKS": {
    "prefixes": ["fix: ", "feat: "],
    "regexp": "docs\\(v[0-9]\\): ",
    "regexpFlags": "i",
    "ignoreLabels" : ["dont-check-PRs-with-this-label", "meta"]
  },
  "MESSAGES": {
    "success": "All OK",
    "failure": "Failing CI test",
    "notice": ""
  }
}

Permissions

  • 'contents': read : This allows the action to list commits of the repository.
  • 'pull-requests': read : This allows the action to list the commits in a Pull Request.

Inputs

  • config: `Path to commit lint config'
  • 'debug':
  • 'dry-run':
  • 'download-dependencies': Experimental - use node to download commitlint config dependency (eg. @commitlint/config-conventional) Default : 'ignore'
  • 'timeout': Change the default timeout for the action (in s). Default : '25'
  • 'body': Pass the body of the PR to the commit as the body. Default : 'false'
  • 'token': GitHub Token for fetching commits using the GitHub API
  • 'fail_on_error': Whether the GitHub Action should fail if commitlint detects an issue.
  • 'configuration_path': path to action config. Default : '.github/pr-merge-commitlint.json'
  • 'pass_on_octokit_error': ... Default: 'false'
  • 'commitlint_version': ... Default : 'latest'
  • 'pr_title': PR title. Default : ${{ github.event.pull_request.title }}
  • 'config_file': Commitlint configuration file path. Default : null
  • 'config': Commitlint configuration plaintext, ignored if config_file provided. Default : module.exports = { extends: ["@commitlint/config-conventional"] };
  • 'node_modules': Path to node_modules directory. Default : null
  • 'node_version': Node.js version, ignored if node_modules provided. Default : v20.15.1
  • 'commitlint_version': Commitlint version, ignored if node_modules provided. Default : ^19.5.0
  • 'additional_node_dependencies': Additional node dependencies, ignored if node_modules is provided. Default : @commitlint/config-conventional@^19.5.0
  • 'base_ref': The source of pull request that triggered this workflow (required for pull requests). Default : ${{ github.base_ref }}
  • 'head_ref': The destination of the pull request that triggered this workflow (required for pull requests). Default : ${{ github.head_ref }}
  • 'target_ref': The Github SHA of the event that triggered this workflow. Default : ${{ github.sha }}
  • 'ref_name': The name of the ref (branch or tag) of the event that triggered this workflow (required for pushes). Default : ${{ github.ref_name }}
  • 'ref_type': The ref type of the event that triggered this workflow (required for pushes). Only branch refs are validated. Default : ${{ github.ref_type }}
  • 'extra_config': An optional newline-separated list of commitlint-config npm packages to install. Default : ''

Outputs

  • 'lint-status'
  • 'lint-details'
  • 'exit_code'
  • 'stdout'
  • 'stderr'
  • 'pr_title'
  • 'pr_number'
  • 'valid'
  • 'outcomes': structured Array as JSON string of the validation feedback
  • 'report': The formatted string report of the validation outcomes'

Resources

主要语言
Shell
星标
0
派生
0
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aRustyDev/gh 的其他 Issue

查看 aRustyDev/gh 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。