You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-40Lines changed: 42 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,46 @@
2
2
<imgsrc="assets/front.png"alt="Image" />
3
3
4
4
5
-
Code embedder is a GitHub action that updates your README.md with up-to-date code snippets from your scripts.
5
+
Keep your code snippets in README files up-to-date with Code-Embedder.
6
6
7
7
## Description
8
-
This action:
9
-
1. reads one or more README files from `readme_paths` input,
10
-
1. looks for specific script tags in the READMEs,
11
-
1. reads the content of the scripts and embeds it in the READMEs at the corresponding tags,
12
-
1. pushes the changes to the repository.
13
8
14
-
## Workflow file structure
9
+
This action looks for the following sections in the readme file:
10
+
````md
11
+
```language:path/to/script
12
+
```
13
+
````
14
+
This action will update the code snippets with the content of the script located at `path/to/script` and push the changes to the repository.
15
+
16
+
### Example
17
+
18
+
You will add the code block sections with path to the scripts in the following format:
19
+
````md
20
+
# README
21
+
22
+
This is a readme.
23
+
24
+
```python:main.py
25
+
```
26
+
````
27
+
And once the worklow runs, the code block sections will be filled with the content of the script located at `main.py` and updated in the readme file.
28
+
29
+
````md
30
+
# README
31
+
32
+
This is a readme.
33
+
34
+
```python:main.py
35
+
print("Embedding successful")
36
+
```
37
+
````
38
+
Once the content of the script located at `main.py` changes, the code block section will be updated in the readme file with the next workflow run.
39
+
40
+
41
+
## Setup
15
42
To use this action, you need to configure a yaml workflow file in `.github/workflows` folder (e.g. `.github/workflows/code-embedder.yaml`) with the following content:
16
43
17
-
```yaml:.github/workflows/code-embedder.yml
44
+
```yaml
18
45
name: Code Embedder
19
46
20
47
on: pull_request
@@ -39,36 +66,11 @@ jobs:
39
66
```
40
67
It requires a secret `GITHUB_TOKEN` with write and repo permission.
41
68
42
-
## README file configuration
43
-
You can specify which README files you want to update with `readme_paths` (paths to markdown files). If no README files are provided, it will by default look for it in the root `README.md`. Argument `readme_paths` accepts multiple paths separated by spaces, example: `README.md README2.md`.
44
-
45
-
The action looks for the following sections in the readme file based on which it will update the code snippets:
46
-
````md
47
-
```language:path/to/script
48
-
```
49
-
````
50
-
These sections will be filled in by content of path/to/script and updated with up-to-date content of the scripts.
51
-
52
-
## Example
69
+
You can specify which README files you want to update with `readme_paths` (paths to markdown files). If no README files are provided, it will by default look for a README file in the root `README.md`. Argument `readme_paths` accepts multiple paths separated by spaces, example: `README.md README2.md`.
53
70
54
-
You will add the code block sections with path to the scripts in the following format:
55
-
````md
56
-
# README
57
-
58
-
This is a readme.
59
-
60
-
```python:main.py
61
-
```
62
-
````
63
-
And once the worklow runs, the code block sections will be filled with the content of the script and updated in the readme file.
64
-
65
-
````md
66
-
# README
67
-
68
-
This is a readme.
69
-
70
-
```python:main.py
71
-
print("Embedding successful")
72
-
```
73
-
````
74
-
Once the content of the script changes, the code block sections will be updated in the readme file.
71
+
## Under the hood
72
+
This action:
73
+
1. reads one or more README files from `readme_paths` input,
74
+
1. looks for script paths in the READMEs,
75
+
1. reads the content of the scripts and embeds it in the READMEs at the corresponding locations,
0 commit comments