feat(action): need a custom action for `commitlint`
未关闭
@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; fromHEAD~1toHEADpull_request: from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} to ${{ github.event.pull_request.head.sha }}
- based on the action event_name.
- 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aRustyDev/gh 的其他 Issue
-
dependencies github-actions
难度 1/5 1 小时以内 新手友好度 10/100
-
dependencies github-actions
难度 1/5 1 小时以内 新手友好度 15/100
-
dependencies github-actions
难度 1/5 1 小时以内 新手友好度 50/100
-
dependencies github-actions
难度 2/5 1-3 小时 新手友好度 20/100
-
dependencies github-actions
难度 2/5 1-3 小时 新手友好度 10/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
CycloneDX/transparency-exchange-api#393 · 1 条评论 ·
-
module/agent platform/macos type/bug/regression
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 92/100
CachyOS/cachyos-aur-derived#754 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
CrowdStrike/falcon-scripts#528 ·
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs 未关闭
难度 2/5 1-3 小时 新手友好度 70/100