Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
Transcript
13 slides
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ブログの校 正を自動化してみた
More Decks by YouYou
See All by YouYou
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
330
今インフラ技術をイチから学び直すなら
yuhta28
1
330
AWSに詳しくない人でも始められるコスト最適化ガイド
yuhta28
3
710
Datadog外形監視基盤をEC2から ECSへ移行してみた
yuhta28
0
1.9k
アウトプット頑張ったら企業からLT登壇の依頼がきた話
yuhta28
1
1.9k
小さなことから始めるAWSコスト最適入門
yuhta28
1
1.5k
Datadogのコストも監視しよう
yuhta28
1
1.1k
Rcloneを使った定期的なストレージ同期
yuhta28
0
910
Pulumiを触ってみよう
yuhta28
1
2.8k
Other Decks in Technology
See All in Technology
AWS DevOps Agentの構造から読み解く運用 AI エージェントの設計原則/aws-devops-agent-design-principles
tomoki10
0
230
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
1
580
AWS re:Invent 2026 FSI Pre-Event Networking Night
junjikoide
0
130
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
17
120k
市販IoT機器や自作IoT機器とHomeAssistantを駆使して家の電気代をできる限り見える化する方法の考案
harutiro
0
410
常時稼働エージェントの作り方(Claude公式ブログを資料化)
minorun365
PRO
18
29k
マネジメントされる側の仕事は「文句」を言うこと
riyaamemiya
7
6k
Kubernetes, Agones, WebRTC, GPU で作る クラウドゲーミング基盤を本番運用に乗せるまで
vivion
0
240
マネージャーをエスパーにしない マネジメントされる側から始める、働きやすい現場づくり
comi190327
1
850
攻撃と守りは何が変わり、何が変わらないのか~最近の不正アクセスから考える、リスク評価と標準の使いどころ
oidfj
2
300
SORACOM × AWS IoT Core でSREする
butadora
0
120
設計手法を「道具」として使いこなすために
a_suenami
7
1.6k
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
360
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
First, design no harm
axbom
PRO
2
1.4k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Bash Introduction
62gerente
615
220k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k