GitHub Spellcheck Action 使用教程
1. 项目目录结构及介绍
spellcheck-github-actions/
├── .dockerignore
├── .gitignore
├── .markdownlint.json
├── .perlcriticrc
├── .pre-commit-config.yaml
├── .shellcheckrc
├── .stevedoreignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── Dockerfile
├── LICENSE
├── README.md
├── action.yml
├── constraint.txt
├── entrypoint.sh
├── requirements.txt
├── spellcheck.yaml
└── wordlist.txt
目录结构介绍
.dockerignore
: Docker 构建时忽略的文件列表。.gitignore
: Git 版本控制时忽略的文件列表。.markdownlint.json
: Markdown 文件的 lint 配置。.perlcriticrc
: Perl 代码的 lint 配置。.pre-commit-config.yaml
: 预提交钩子的配置文件。.shellcheckrc
: Shell 脚本的 lint 配置。.stevedoreignore
: Stevedore 工具的忽略文件列表。CHANGELOG.md
: 项目更新日志。CODE_OF_CONDUCT.md
: 项目行为准则。Dockerfile
: Docker 镜像构建文件。LICENSE
: 项目许可证。README.md
: 项目介绍和使用说明。action.yml
: GitHub Action 的配置文件。constraint.txt
: 项目依赖约束文件。entrypoint.sh
: 项目启动脚本。requirements.txt
: Python 依赖包列表。spellcheck.yaml
: 拼写检查配置文件。wordlist.txt
: 自定义词汇列表,用于拼写检查。
2. 项目启动文件介绍
entrypoint.sh
entrypoint.sh
是项目的启动脚本,负责执行拼写检查任务。该脚本会根据配置文件 spellcheck.yaml
中的设置,对指定的文件进行拼写检查。
启动步骤
- 配置文件准备: 确保
spellcheck.yaml
配置文件存在且正确。 - 执行脚本: 运行
entrypoint.sh
脚本,启动拼写检查任务。
3. 项目配置文件介绍
spellcheck.yaml
spellcheck.yaml
是拼写检查的核心配置文件,定义了拼写检查的规则和目标文件。
配置示例
tasks:
- name: Markdown
sources:
- '**/*.md'
aspell:
lang: en
dictionary:
wordlists:
- wordlist.txt
配置项说明
tasks
: 定义拼写检查的任务列表。name
: 任务名称。sources
: 指定需要检查的文件路径模式。aspell
: Aspell 配置项。lang
: 指定检查的语言。
dictionary
: 自定义词汇列表配置。wordlists
: 自定义词汇文件路径。
action.yml
action.yml
是 GitHub Action 的配置文件,定义了 Action 的输入、输出和运行环境。
配置示例
name: Spellcheck Action
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: rojopolis/spellcheck-github-actions@v0
with:
source_files: 'README.md CHANGELOG.md'
task_name: Markdown
配置项说明
name
: Action 的名称。on
: 触发 Action 的事件。jobs
: 定义工作流中的任务。build
: 任务名称。runs-on
: 运行任务的操作系统环境。steps
: 任务步骤。uses
: 使用的 Action。with
: 传递给 Action 的参数。source_files
: 指定需要检查的文件。task_name
: 指定运行的任务名称。
通过以上配置,您可以自定义拼写检查的范围和规则,确保代码库中的文本文件拼写正确。
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考