Skip to content
This repository was archived by the owner on Feb 16, 2024. It is now read-only.

Commit 2586bf9

Browse files
authored
fix(readme-parser): one-by-one commits, fix vsce command, fix pipeline fail due to grep status code 1
1 parent 405566b commit 2586bf9

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ jobs:
3636
changed_files=$(git diff --name-only origin/main)
3737
3838
# Filter for README files in the 'codemods' directory
39-
readme_file=$(echo "$changed_files" | grep '^codemods/.*README\.md$')
39+
readme_files=$(echo "$changed_files" | grep '^codemods/.*README\.md$' || true)
4040
41-
if [ -z "$readme_file" ]; then
41+
if [ -z "$readme_files" ]; then
4242
echo "No README.md file in 'codemods' directory changed."
4343
exit 0
4444
fi
@@ -55,7 +55,7 @@ jobs:
5555
# Parse the README and store the output with its path
5656
parsed_readme=$("$PWD"/readme-parser/dist/index.js "$path_to_readme")
5757
parsed_readmes["$website_file_path"]="$parsed_readme"
58-
done <<< "$readme_file"
58+
done <<< "$readme_files"
5959
6060
# Checkout a new branch from the website master
6161
git checkout -b update-codemods website/master
@@ -66,13 +66,10 @@ jobs:
6666
echo $(git status)
6767
echo "${parsed_readmes[$website_file_path]}" > "$website_file_path"
6868
git add "$website_file_path"
69+
git commit -m "$website_file_path"
6970
echo $(ls "$website_file_path" -la)
7071
done
7172
72-
# Commit and push all changes at once
73-
path_without_first_dir="${readme_file#*/}"
74-
final_path="${path_without_first_dir%/*}"
75-
git commit -m "$final_path"
7673
git push website HEAD:master
7774
- name: Upload to S3
7875
uses: jakejarvis/s3-sync-action@master

readme-parser/parse.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,30 +92,30 @@ describe('parse/yaml', function () {
9292
'This is an amazing codemod\n### WARNING\nThis codemod does the thing',
9393
examples:
9494
'### tsconfig.json\n' +
95-
'### Before\n' +
95+
'### Before\n\n' +
9696
'```ts\n' +
9797
"http.get<ReqBodyType, PathParamsType>('/resource', (req, res, ctx) => {\n" +
9898
" return res(ctx.json({ firstName: 'John' }));\n" +
9999
'});\n' +
100-
'```\n' +
101-
'### After\n' +
100+
'```\n\n' +
101+
'### After\n\n' +
102102
'```ts\n' +
103103
"http.get<PathParamsType, ReqBodyType>('/resource', (req, res, ctx) => {\n" +
104104
" return res(ctx.json({ firstName: 'John' }));\n" +
105105
'});\n' +
106-
'```\n' +
107-
'### Before\n' +
106+
'```\n\n' +
107+
'### Before\n\n' +
108108
'```ts\n' +
109109
"http.get<ReqBodyType>('/resource', (req, res, ctx) => {\n" +
110110
" return res(ctx.json({ firstName: 'John' }));\n" +
111111
'});\n' +
112-
'```\n' +
113-
'### After\n' +
112+
'```\n\n' +
113+
'### After\n\n' +
114114
'```ts\n' +
115115
"http.get<any, ReqBodyType>('/resource', (req, res, ctx) => {\n" +
116116
" return res(ctx.json({ firstName: 'John' }));\n" +
117117
'});\n' +
118-
'```',
118+
'```\n',
119119
applicability: 'MSW >= 1.0.0',
120120
version: '1.0.0',
121121
changeMode: 'assistive',
@@ -194,7 +194,7 @@ f_long-description: >-
194194
\`\`\`
195195
196196
f_github-link: https://github.com/intuita-inc/codemod-registry/tree/main/codemods/msw/2/imports
197-
f_vs-code-link: vscode://intuita.intuita-vscode-extension/cases/${vscodeHashDigest}
197+
f_vs-code-link: vscode://intuita.intuita-vscode-extension/showCodemod?chd=${vscodeHashDigest}
198198
f_codemod-studio-link: n/a
199199
f_cli-command: intuita msw/2/imports
200200
f_framework: cms/framework/msw.md

readme-parser/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ f_github-link: ${
372372
}
373373
f_vs-code-link: ${
374374
vscodeHashDigest
375-
? `vscode://intuita.intuita-vscode-extension/cases/${vscodeHashDigest}`
375+
? `vscode://intuita.intuita-vscode-extension/showCodemod?chd=${vscodeHashDigest}`
376376
: 'n/a'
377377
}
378378
f_codemod-studio-link: n/a

0 commit comments

Comments
 (0)