Merge pull request #1193 from Its-Just-Nans/update-doc

Update doc for actions
This commit is contained in:
Ed Page 2024-12-30 08:34:09 -06:00 committed by GitHub
commit 910f3c8af0
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 25 deletions

View file

@ -25,6 +25,7 @@ pre-release-replacements = [
{file="../../CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/crate-ci/typos/compare/{{tag_name}}...HEAD", exactly=1}, {file="../../CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/crate-ci/typos/compare/{{tag_name}}...HEAD", exactly=1},
{file="../../action/entrypoint.sh", search="VERSION=.*", replace="VERSION={{version}}", min=1}, {file="../../action/entrypoint.sh", search="VERSION=.*", replace="VERSION={{version}}", min=1},
{file="../../docs/pre-commit.md", search="rev: .*", replace="rev: {{tag_name}}", exactly=1}, {file="../../docs/pre-commit.md", search="rev: .*", replace="rev: {{tag_name}}", exactly=1},
{file="../../docs/github-action.md", search="uses: crate-ci/typos@.*", replace="uses: crate-ci/typos@{{tag_name}}", min=1},
{file="../../setup.py", search="TYPOS_VERSION = .*", replace="TYPOS_VERSION = '{{version}}'", exactly=1}, {file="../../setup.py", search="TYPOS_VERSION = .*", replace="TYPOS_VERSION = '{{version}}'", exactly=1},
] ]

View file

@ -1,8 +1,52 @@
# GitHub Action # GitHub Action
If you want an easy way to test your repository spelling (or a subset of files) If you want an easy way to test your repository spelling (or a subset of files)
you can use the Typos Action! It is served from this repository, and can you can use the Typos Action!
easily be used as follows:
```yaml
name: Spelling
permissions:
contents: read
on: [pull_request]
env:
CLICOLOR: 1
jobs:
spelling:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Spell Check Repo
uses: crate-ci/typos@v1.28.4
```
**Requirements:** The runner must have `wget` installed
(see
[#769](https://github.com/crate-ci/typos/issues/769)
[#1191](https://github.com/crate-ci/typos/issues/1191)
).
## Input
| Name | Description | Required | Default |
| ------------------ | --------------------------------------------------------------- | -------- | ---------------------------------------------------- |
| files | Files or patterns to check | false | If not defined, the default set of files are checked |
| extend_identifiers | Comma separated list of extend identifiers, like someone's name | false | not set |
| extend_words | Comma separated list of extend words. | false | not set |
| isolated | Ignore implicit configuration files | false | false |
| write_changes | Writes changes on the Action's local checkout | false | false |
| config | Use a custom config file (must exist) | false | not set |
`write_changes`: doesn't commit or push anything to the branch. It only writes the changes locally
to disk, and this can be combined with other actions, for instance that will [submit code
suggestions based on that local diff](https://github.com/getsentry/action-git-diff-suggestions).
### Examples
```yaml ```yaml
name: Test GitHub Action name: Test GitHub Action
@ -17,43 +61,24 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Check spelling of file.txt - name: Check spelling of file.txt
uses: crate-ci/typos@master uses: crate-ci/typos@v1.28.4
with: with:
files: ./file.txt files: ./file.txt
- name: Use custom config file - name: Use custom config file
uses: crate-ci/typos@master uses: crate-ci/typos@v1.28.4
with: with:
files: ./file.txt files: ./file.txt
config: ./myconfig.toml config: ./myconfig.toml
- name: Ignore implicit configuration file - name: Ignore implicit configuration file
uses: crate-ci/typos@master uses: crate-ci/typos@v1.28.4
with: with:
files: ./file.txt files: ./file.txt
isolated: true isolated: true
- name: Writes changes in the local checkout - name: Writes changes in the local checkout
uses: crate-ci/typos@master uses: crate-ci/typos@v1.28.4
with: with:
write_changes: true write_changes: true
``` ```
**Important** for any of the examples above, make sure that you choose
a release or commit as a version, and not a branch (which is a moving target).
Also make sure when referencing relative file paths to use `./` (e.g., `./file.txt` instead of
`file.txt`.
`write_changes` doesn't commit or push anything to the branch. It only writes the changes locally
to disk, and this can be combined with other actions, for instance that will [submit code
suggestions based on that local diff](https://github.com/getsentry/action-git-diff-suggestions).
## Variables
| Name | Description | Required | Default |
|------|-------------|----------|---------|
| files| Files or patterns to check | false | If not defined, the default set of files are checked |
| isolated | Ignore implicit configuration files | false | false|
| config | Use a custom config file (must exist) | false | not set |
| write_changes | Writes changes on the Action's local checkout | false | false |