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

Commit

Permalink
fix(readme-parser): one-by-one commits, fix vsce command, fix pipelin…
Browse files Browse the repository at this point in the history
…e fail due to grep status code 1
  • Loading branch information
r4zendev authored Dec 20, 2023
1 parent 405566b commit 2586bf9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
changed_files=$(git diff --name-only origin/main)
# Filter for README files in the 'codemods' directory
readme_file=$(echo "$changed_files" | grep '^codemods/.*README\.md$')
readme_files=$(echo "$changed_files" | grep '^codemods/.*README\.md$' || true)
if [ -z "$readme_file" ]; then
if [ -z "$readme_files" ]; then
echo "No README.md file in 'codemods' directory changed."
exit 0
fi
Expand All @@ -55,7 +55,7 @@ jobs:
# Parse the README and store the output with its path
parsed_readme=$("$PWD"/readme-parser/dist/index.js "$path_to_readme")
parsed_readmes["$website_file_path"]="$parsed_readme"
done <<< "$readme_file"
done <<< "$readme_files"
# Checkout a new branch from the website master
git checkout -b update-codemods website/master
Expand All @@ -66,13 +66,10 @@ jobs:
echo $(git status)
echo "${parsed_readmes[$website_file_path]}" > "$website_file_path"
git add "$website_file_path"
git commit -m "$website_file_path"
echo $(ls "$website_file_path" -la)
done
# Commit and push all changes at once
path_without_first_dir="${readme_file#*/}"
final_path="${path_without_first_dir%/*}"
git commit -m "$final_path"
git push website HEAD:master
- name: Upload to S3
uses: jakejarvis/s3-sync-action@master
Expand Down
18 changes: 9 additions & 9 deletions readme-parser/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,30 @@ describe('parse/yaml', function () {
'This is an amazing codemod\n### WARNING\nThis codemod does the thing',
examples:
'### tsconfig.json\n' +
'### Before\n' +
'### Before\n\n' +
'```ts\n' +
"http.get<ReqBodyType, PathParamsType>('/resource', (req, res, ctx) => {\n" +
" return res(ctx.json({ firstName: 'John' }));\n" +
'});\n' +
'```\n' +
'### After\n' +
'```\n\n' +
'### After\n\n' +
'```ts\n' +
"http.get<PathParamsType, ReqBodyType>('/resource', (req, res, ctx) => {\n" +
" return res(ctx.json({ firstName: 'John' }));\n" +
'});\n' +
'```\n' +
'### Before\n' +
'```\n\n' +
'### Before\n\n' +
'```ts\n' +
"http.get<ReqBodyType>('/resource', (req, res, ctx) => {\n" +
" return res(ctx.json({ firstName: 'John' }));\n" +
'});\n' +
'```\n' +
'### After\n' +
'```\n\n' +
'### After\n\n' +
'```ts\n' +
"http.get<any, ReqBodyType>('/resource', (req, res, ctx) => {\n" +
" return res(ctx.json({ firstName: 'John' }));\n" +
'});\n' +
'```',
'```\n',
applicability: 'MSW >= 1.0.0',
version: '1.0.0',
changeMode: 'assistive',
Expand Down Expand Up @@ -194,7 +194,7 @@ f_long-description: >-
\`\`\`
f_github-link: https://github.com/intuita-inc/codemod-registry/tree/main/codemods/msw/2/imports
f_vs-code-link: vscode://intuita.intuita-vscode-extension/cases/${vscodeHashDigest}
f_vs-code-link: vscode://intuita.intuita-vscode-extension/showCodemod?chd=${vscodeHashDigest}
f_codemod-studio-link: n/a
f_cli-command: intuita msw/2/imports
f_framework: cms/framework/msw.md
Expand Down
2 changes: 1 addition & 1 deletion readme-parser/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ f_github-link: ${
}
f_vs-code-link: ${
vscodeHashDigest
? `vscode://intuita.intuita-vscode-extension/cases/${vscodeHashDigest}`
? `vscode://intuita.intuita-vscode-extension/showCodemod?chd=${vscodeHashDigest}`
: 'n/a'
}
f_codemod-studio-link: n/a
Expand Down

0 comments on commit 2586bf9

Please sign in to comment.