Skip to content

Commit 7798cda

Browse files
committed
🐛 fix: stop using ztoq.sh
1 parent 3e45d10 commit 7798cda

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

action.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,25 @@ runs:
4444
- name: Convert Zenn articles to Qiita format
4545
run: |
4646
for file in $(cat $GITHUB_WORKSPACE/changed_files.txt); do
47-
bash ${{ github.action_path }}/bin/ztoq.sh "$file"
47+
filename=$(basename "$file" .md)
48+
echo "🚀 Convert $file to Qiita format"
49+
if [[ "$file" != ./articles/* ]]; then
50+
echo "invalid file path: $file"
51+
if [[ -f "qiita/public/$filename.md" ]]; then
52+
echo "delete qiita/public/$filename.md cuz it's not included in articles/"
53+
rm "qiita/public/$filename.md"
54+
fi
55+
continue
56+
fi
57+
58+
if [[ ! -f "qiita/public/$filename.md" ]] && grep -q "published: true" "$file"; then
59+
cd ./qiita
60+
npx qiita new "$filename"
61+
cd ../
62+
fi
63+
64+
echo "🚚 Convert $file to qiita/public/$FILENAME.md"
65+
./node_modules/.bin/ts-node $GITHUB_WORKSPACE/scripts/ztoq.tsx "$file" "./qiita/public/$file.md"
4866
done
4967
shell: bash
5068
if: steps.files.outcome == 'success'

0 commit comments

Comments
 (0)