From 478eb0f2b9c1dff54c1dd3156e8c660166fb8180 Mon Sep 17 00:00:00 2001 From: n4n5 Date: Mon, 30 Dec 2024 14:44:35 +0100 Subject: [PATCH 1/8] docs(action): Clean up variable table formatting --- docs/github-action.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/github-action.md b/docs/github-action.md index 9ffad81..0207a48 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -51,9 +51,11 @@ suggestions based on that local diff](https://github.com/getsentry/action-git-di ## 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 | +| 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 | From 33db0128403f2580d805d45727153de68a79529e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 30 Dec 2024 08:05:49 -0600 Subject: [PATCH 2/8] docs(action): Document write_changes in Variables section --- docs/github-action.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/github-action.md b/docs/github-action.md index 0207a48..ac805a1 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -45,10 +45,6 @@ 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 | @@ -59,3 +55,7 @@ suggestions based on that local diff](https://github.com/getsentry/action-git-di | 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). From ff7a8be9799e0bce6880c32b6efadfae55130985 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 30 Dec 2024 08:08:51 -0600 Subject: [PATCH 3/8] docs(action): Rename Variables to Input --- docs/github-action.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/github-action.md b/docs/github-action.md index ac805a1..d2f9d67 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -45,7 +45,7 @@ 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`. -## Variables +## Input | Name | Description | Required | Default | | ------------------ | --------------------------------------------------------------- | -------- | ---------------------------------------------------- | From aa901406900a431b0c92c0497ed7263aa2df5b7b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 30 Dec 2024 08:10:39 -0600 Subject: [PATCH 4/8] docs(action): Remove note about leading ./ This has been there since #267 but it isn't clear why it should be. --- docs/github-action.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/github-action.md b/docs/github-action.md index d2f9d67..174bb84 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -42,9 +42,6 @@ jobs: **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`. - ## Input | Name | Description | Required | Default | From bb2758bfa3025713822ea1efec9856e2057a5185 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 30 Dec 2024 08:18:02 -0600 Subject: [PATCH 5/8] docs(action): Demonstrate pinning actions --- crates/typos-cli/Cargo.toml | 1 + docs/github-action.md | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/typos-cli/Cargo.toml b/crates/typos-cli/Cargo.toml index 002d5b8..129f7d1 100644 --- a/crates/typos-cli/Cargo.toml +++ b/crates/typos-cli/Cargo.toml @@ -25,6 +25,7 @@ pre-release-replacements = [ {file="../../CHANGELOG.md", search="", replace="\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="../../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}, ] diff --git a/docs/github-action.md b/docs/github-action.md index 174bb84..9755ea5 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -17,31 +17,28 @@ jobs: uses: actions/checkout@v4 - name: Check spelling of file.txt - uses: crate-ci/typos@master + uses: crate-ci/typos@v1.28.4 with: files: ./file.txt - name: Use custom config file - uses: crate-ci/typos@master + uses: crate-ci/typos@v1.28.4 with: files: ./file.txt config: ./myconfig.toml - name: Ignore implicit configuration file - uses: crate-ci/typos@master + uses: crate-ci/typos@v1.28.4 with: files: ./file.txt isolated: true - name: Writes changes in the local checkout - uses: crate-ci/typos@master + uses: crate-ci/typos@v1.28.4 with: 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). - ## Input | Name | Description | Required | Default | From 679c20bbe339e33b44ba81a74e48367fcb3acac4 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 30 Dec 2024 08:24:51 -0600 Subject: [PATCH 6/8] docs(action): Pull out existing examples --- docs/github-action.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/docs/github-action.md b/docs/github-action.md index 9755ea5..50296e9 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -1,8 +1,24 @@ # GitHub Action 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 -easily be used as follows: +you can use the Typos Action! + +## 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 name: Test GitHub Action @@ -38,18 +54,3 @@ jobs: with: write_changes: true ``` - -## 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). From 92d01f198fdd5929ad39013f437c4b6047567ca1 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 30 Dec 2024 08:25:17 -0600 Subject: [PATCH 7/8] docs(action): Show a complete example --- docs/github-action.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/github-action.md b/docs/github-action.md index 50296e9..9f50a6e 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -3,6 +3,28 @@ If you want an easy way to test your repository spelling (or a subset of files) you can use the Typos Action! +```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 +``` + ## Input | Name | Description | Required | Default | From 8e9777e0ad56dfb349094f17c389b9e0069fb50a Mon Sep 17 00:00:00 2001 From: n4n5 Date: Mon, 30 Dec 2024 14:44:35 +0100 Subject: [PATCH 8/8] docs(action): Note the requirement on wget --- docs/github-action.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/github-action.md b/docs/github-action.md index 9f50a6e..4b181ab 100644 --- a/docs/github-action.md +++ b/docs/github-action.md @@ -25,6 +25,12 @@ jobs: 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 |