Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GitHub ActionsでZennブログの校正を自動化してみた
Search
YouYou
April 04, 2021
Technology
3.6k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GitHub ActionsでZennブログの校正を自動化してみた
詳細ブログ⇓
https://zenn.dev/yuta28/articles/blog-lint-ci-reviewdog
YouYou
April 04, 2021
More Decks by YouYou
See All by YouYou
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
310
今インフラ技術をイチから学び直すなら
yuhta28
1
310
AWSに詳しくない人でも始められるコスト最適化ガイド
yuhta28
3
680
Datadog外形監視基盤をEC2から ECSへ移行してみた
yuhta28
0
1.8k
アウトプット頑張ったら企業からLT登壇の依頼がきた話
yuhta28
1
1.9k
小さなことから始めるAWSコスト最適入門
yuhta28
1
1.5k
Datadogのコストも監視しよう
yuhta28
1
1.1k
Rcloneを使った定期的なストレージ同期
yuhta28
0
870
Pulumiを触ってみよう
yuhta28
1
2.8k
Other Decks in Technology
See All in Technology
【GCC2026】鉄拳8でのVFX開発事例
bandainamcostudios
PRO
0
120
Flutter × BLE Centralを自前Pluginで実装する設計パターン - MethodChannel / EventChannelで作る双方向ブリッジの実践 / Building Custom Flutter BLE Central Plugins: Bidirectional Bridging with Method & Event Channels
bitkey
PRO
0
190
会社紹介資料 / Sansan Company Profile
sansan33
PRO
24
430k
猫付きpingコマンドを自作
uyuki234
0
280
SmartHR Engineering Team Deck
smarthr
1
3.1k
ハーレムエンジニアリング
kazuma777777
0
190
AI for Science時代を切り開く、政府の次世代HPC戦略の展望
gpuunite_official
0
130
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
180
MIXIで活躍できるエンジニアを 若手社員目線で考えてみる
mixi_engineers
PRO
0
110
20分でわかるセキュアAPI
nwiizo
2
320
作って理解するCoding Agent 〜フレームワークに頼らないピュア Python での実装〜
takapy
2
140
老害フォレンジッカーはAI羊の夢を見るか?
tadmaddad
0
360
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Automating Front-end Workflow
addyosmani
1369
210k
Code Reviewing Like a Champion
maltzj
528
40k
Discover your Explorer Soul
emna__ayadi
2
1.3k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
Exploring anti-patterns in Rails
aemeredith
3
470
Build your cross-platform service in a week with App Engine
jlugia
234
19k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
GraphQLとの向き合い方2022年版
quramy
50
15k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Transcript
GitHub Actionsで ブログの校正を自動化してみた
Name:ユータ Occupation:インフラエンジニア Twitter:@Y0u281 (オーでなくゼロです) ブログ:https://zenn.dev/yuta28 → 普段触るもの:AWS Ansible Linux Mint
自己紹介 Twitter
目次 • 背景 • 技術スタック紹介 ◦ textlint ◦ reviewdog •
実装 • 工夫ポイント • まとめ
背景 • ZennブログをGitHub連携することができるようになった☆ ◦ Zenn個人開発の限界に挑んだ話 - devsumi 2021 詳しくは開発者のプレゼン 👀 •
CIツールを導入する事で自動化が可能に👏 ◦ リポジトリを更新する度にドキュメントの校正 ◦ イイ感じのブログ執筆
textlint • mdファイルやプレーンテキスト向けのLinterツール • npm install textlint `textlint-rurle` → ルールもインストール •
デフォルトルールが存在せず、自分でルールを決めなければならない • .textlintrc にルールを記述 https://textlint.github.io/
textlint # .textlintrc { "rules": { "preset-smarthr": { "sentence-length": false
}, "prh": { "rulePaths": [ "dict/smarthr-prh-basic.yml", "dict/smarthr-prh-tech-word.yml" ] } } } ルール • textlint-rule-preset-smarthr • textlint-rule-prh 参照 よりよい文書を書くための校正ツール「 textlint」の SmartHR用ルールプリセットを公開しました! |SmartHRオープン社内報
reviewdog • GitHubにlinterツールで検知した指摘事項をレビューコメントに投稿 • Goで書かれたOSS • Circle CIやGitHub Actionsなど複数のCIサービスと連携可能 https://github.com/reviewdog/reviewdog
実装 jobs: reviewdog-github-check: name: reviewdog (github-check) runs-on: ubuntu-latest steps: #reviewdogのアクション
- uses: reviewdog/action-setup@v1 with: reviewdog_version: latest #textlintを動かすための nodeアクション - uses: actions/setup-node@v2 - name: Install textlint run: 'npm install --save-dev textlint-rule-preset-smarthr textlint-rule-prh' - name: Install dependent module run: npm install - name: Execute textlint for ブログ記事 run: | npx textlint -f checkstyle "articles/*.md" >> .textlint.log - name: Run reviewdog # textlintで文章上のミスがあった場合のみ、 reviewdogを実行させるようにする if: failure() env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cat .textlint.log | reviewdog -f=checkstyle -name="textlint" -reporter="github-pr-review" 1) reviewdog,nodeのアクションを起動 2) textlintのインストール 3) textlintを記事に対して実行 4) 何かしらの記載ミスが有った場合のみtextlintの出力結果を reviewdogに渡してGitHubにレビューコメントを投稿
デモ イメージ図
工夫ポイント • キャッシュを使って高速化 ◦ GitHub Actionの公式にactions/cache • stepが失敗するとキャッシュしてくれない • stepが終了してもキャッシュしてくれるアク
ションを使う https://github.com/pat-s/always-upload-c ache #stepsが失敗(文章の乱れ)した場合でもcacheを取得するようにする uses: pat-s/
[email protected]
env: cache-name: cache-node-modules with: path: ~/.npm key: node-${{ hashFiles('**/package-lock.json') }} restore-keys: | node-
工夫ポイント • キャッシュ前(初回実行) 50秒 • キャッシュ取得後(2回目以降) 29秒
まとめ
ありがとうございました より詳しい内容は以下のブログで ↓ GitHub ActionsでZennブログの校 正を自動化してみた