This policy scaffolds a typos GitHub Action workflow for spell checking in your repositories.
typos is a fast source code spell checker that finds and fixes typos in source code and documentation.
Updatecli is a tool for automating configuration updates across multiple repositories. This policy uses Updatecli to intelligently deploy typos spell checking to your GitHub Action workflows.
The policy will create a new typos workflow and, if configured, a _typos.toml configuration file.
This policy implements a two-step process:
Deployment: Creates .github/workflows/typos.yaml with the latest typos action version and compatible checkout action.
Configuration (optional): Creates _typos.toml with your custom typos configuration when the config value is set.
The workflow runs on all pull requests and pushes to main, checking for typos in the repository.
updatecliCLI installed (recommended: latest stable release)- Access to an OCI registry (set the
OCI_REGISTRYenvironment variable) - Optional:
docker(or another OCI client) for logging in and pulling/pushing policy - GitHub Token (
UPDATECLI_GITHUB_TOKEN): Personal access token with scopes:repo(full control of private repositories)workflow(read/write GitHub Actions workflows)
- GitHub Username (
UPDATECLI_GITHUB_USERNAME): GitHub account username for commit attribution
Create a values.yaml file to customize the policy:
# Required: SCM configuration to target repositories
scm:
enabled: true
kind: githubsearch
search: |
repo:myorg/repo1
repo:myorg/repo2
fork:true
branch: "^main$"
email: [email protected]
limit: 0 # 0 = no limit
# Optional: Override pipelineId
pipelineid: "gha_typos"
# Optional: provide a typos configuration file content
#config: |
# [files]
# extend-exclude = [
# "go.mod",
# "_typos.toml"
# ]Tips: you can adjust the search field to target specific repositories, branches, or include forks as needed. More information
on GitHub
Set up your environment:
export UPDATECLI_GITHUB_TOKEN="your_github_token"
export UPDATECLI_GITHUB_USERNAME="your_github_username"Show the policy manifest (parse configuration):
updatecli manifest show --config updatecli.d --values values.yamlDry-run to see what changes would be made:
updatecli pipeline diff --config updatecli.d --values values.yamlApply the policy (create the typos workflow):
updatecli pipeline apply --config updatecli.d --values values.yamlAfter publishing (see PUBLISH section), use the policy from a registry:
Show the policy:
updatecli manifest show --values values.yaml ghcr.io/updatecli/policies/typos/githubactionDry-run:
updatecli pipeline diff --values values.yaml ghcr.io/updatecli/policies/typos/githubactionApply:
updatecli pipeline apply --values values.yaml ghcr.io/updatecli/policies/typos/githubactionAuthenticate with your OCI registry before publishing or pulling private bundles:
docker login "$OCI_REGISTRY"OCI_REGISTRY can be any OCI-compliant registry (for example: Zot, Docker Hub, GitHub Container Registry).
Publish the bundle to an OCI registry (the version field in Policy.yaml controls the tag):
updatecli manifest push \
--config updatecli.d \
--values values.yaml \
--policy Policy.yaml \
--tag "$OCI_REGISTRY/<policy-name>" \
.After publishing, reference the bundle by tag:
updatecli manifest show "$OCI_REGISTRY/<policy-name>:v1.0.0"-
Verify conditions are met:
updatecli manifest show --config updatecli.d --values values.yaml
-
Check GitHub token permissions:
- Ensure token has
repoandworkflowscopes - Verify token has write access to target repositories
- Ensure token has
-
Debug mode:
updatecli pipeline diff --log-level debug --config updatecli.d --values values.yaml
- The typos workflow triggers on
pull_requestevents and pushes tomainby default - Open a pull request to the repository to see it in action
- Check the workflow runs in the repository's Actions tab
Edit the template asset to customize typos behavior:
- Template location:
assets/gha_typos.yaml - After editing, republish the policy bundle (see PUBLISH section)
- Change trigger events: Modify the
on:section in the template - Add custom word list: Use the
configvalue to provide a_typos.tomlconfiguration - Configure typos options: Adjust the
with:parameters for the typos action
Increment the version field in Policy.yaml before republishing to track changes.
- Official docs: https://www.updatecli.io
- Compose docs (orchestrating multiple policies): https://www.updatecli.io/docs/core/compose/
- Sharing & reuse: https://www.updatecli.io/docs/core/shareandreuse/
- typos GitHub Action: https://github.com/crate-ci/typos
- Updatecli Policies: https://github.com/updatecli/policies