Skip to content

Commit 8e1e91d

Browse files
committed
add document for the update-checks-doc script
1 parent be162f0 commit 8e1e91d

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ To report a bug, please submit a new ticket on GitHub. It's helpful to search si
55
https://github.com/rhysd/actionlint/issues/new
66

77
Providing a reproducible workflow content is much appreciated. If only a small snippet of workflow is provided or no
8-
input is provided at all, such issue tickets may get lower priority since they are occasionally time consuming to
8+
input is provided at all, such issue tickets may get lower priority because they are occasionally time consuming to
99
investigate.
1010

1111
# Sending a patch
@@ -21,6 +21,10 @@ Before submitting your PR, please ensure the following points:
2121
- Confirm build/tests/lints passed. How to run them is described in the following sections.
2222
- If you added a new feature, consider to add tests and explain it in [the usage document](docs/usage.md).
2323
- If you added a new public API, consider to add tests and a doc comment for the API.
24+
- If you updated [the checks document](docs/checks.md), ensure to run [the maintenance script](#about-checks-doc).
25+
26+
Special thanks to the native English speakers for proofreading the documentation and error messages, as the author is not
27+
proficient in English.
2428

2529
# Development
2630

@@ -219,3 +223,14 @@ All tests are automated.
219223
- `testdata/projects/` contains 'Project' tests. Each directories represent a single project (meaning a repository on GitHub).
220224
Corresponding `*.out` files are expected error messages. Empty `*.out` file means the test case should cause no errors.
221225
'Project' test is used for use cases where multiple files are related (reusable workflows, local actions, config files, ...).
226+
227+
<a id="about-checks-doc"></a>
228+
## How to write checks document
229+
230+
The ['Checks' document](./docs/checks.md) is a large document to explain all checks by actionlint.
231+
232+
This document is maintained with [`update-checks-doc`](./scripts/update-checks-doc) script. This script automatically updates
233+
the code blocks after `Output:` and the `Playground` links. This script should be run after modifying the document.
234+
235+
Please see [the readme of the script](./scripts/update-checks-doc/README.md) for the usage and knowing the details of the
236+
document format that this script assumes.

scripts/update-checks-doc/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
update-checks-doc
2+
=================
3+
4+
This is a script to maintain [the 'Checks' document](../../docs/checks.md).
5+
6+
This script does:
7+
8+
- update the outputs of the example inputs; the code blocks after `Output:` header
9+
- update the links to the [playground](https://rhysd.github.io/actionlint/) for the example inputs
10+
11+
For making the implementation simple, this script does not support Windows. Please run this script
12+
on Linux or macOS.
13+
14+
## Usage
15+
16+
Update the document. This command directly modifies the file.
17+
18+
```sh
19+
go run ./scripts/update-checks-doc ./docs/checks.md
20+
```
21+
22+
Check the document is up-to-date.
23+
24+
```sh
25+
go run ./scripts/update-checks-doc -check ./docs/checks.md
26+
```
27+
28+
The check is run on the [CI workflow](../../.github/workflows/ci.yaml).
29+
30+
## Format
31+
32+
The format of the check document is:
33+
34+
````markdown
35+
<a id="some-id"></a>
36+
## This is title of the check
37+
38+
Example input:
39+
40+
```yaml
41+
This section is referred to generate the output and the playground link
42+
```
43+
44+
Output:
45+
46+
```
47+
This section will be auto-generated
48+
```
49+
50+
[Playground](https://rhysd.github.io/actionlint/#THIS_HASH_PART_WILL_BE_AUTO_GENERATED)
51+
52+
Explanation for the check...
53+
````
54+
55+
When you don't want to update the output by this script, put the comment as follows. This script
56+
will ignore the code block. Instead you need to write the output in the code blcok manually.
57+
58+
```yaml
59+
Output:
60+
<!-- Skip update output -->
61+
```
62+
63+
When you don't want to put a playground link for your example input, put the comment as follows
64+
instead of the link. This script will not generate the hash for the playground link.
65+
66+
```yaml
67+
<!-- Skip playground link -->
68+
```

0 commit comments

Comments
 (0)