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
DangerでスムーズなPRレビューを
Search
masakazu sano
September 12, 2017
Technology
1
370
DangerでスムーズなPRレビューを
2017/09/12 iOS社内勉強会 @OHAKO.inc にて公開したスライドです
masakazu sano
September 12, 2017
Tweet
Share
More Decks by masakazu sano
See All by masakazu sano
Manual DI with ReactorKit
kz56cd
1
760
CoreNFCファーストインプレッション(仮)
kz56cd
0
70
Other Decks in Technology
See All in Technology
GopherCon Tour 概略
logica0419
2
190
Modern_Data_Stack最新動向クイズ_買収_AI_激動の2025年_.pdf
sagara
0
220
生成AIで「お客様の声」を ストーリーに変える 新潮流「Generative ETL」
ishikawa_satoru
1
320
SOC2取得の全体像
shonansurvivors
1
400
多様な事業ドメインのクリエイターへ 価値を届けるための営みについて
massyuu
1
300
BirdCLEF+2025 Noir 5位解法紹介
myso
0
200
Findy Team+のSOC2取得までの道のり
rvirus0817
0
350
Green Tea Garbage Collector の今
zchee
PRO
2
390
KAGのLT会 #8 - 東京リージョンでGAしたAmazon Q in QuickSightを使って、報告用の資料を作ってみた
0air
0
200
Where will it converge?
ibknadedeji
0
190
多野優介
tanoyusuke
1
450
生成AIを活用したZennの取り組み事例
ryosukeigarashi
0
200
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Side Projects
sachag
455
43k
Building Applications with DynamoDB
mza
96
6.6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.6k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
580
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
19
1.2k
Agile that works and the tools we love
rasmusluckow
331
21k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Fireside Chat
paigeccino
40
3.7k
RailsConf 2023
tenderlove
30
1.2k
Transcript
DangerͰ εϜʔζͳPRϨϏϡʔΛ 2017/09/12 iOSࣾษڧձ @OHAKO.inc Masakazu Sano (@kz56cd)
Dangerʁ
None
You can use Danger to codify your teams norms, leaving
humans to think about harder problems.
Dangerͱ νʔϜ։ൃͰࡉ͔ͳϧʔϧ͕ଘࡏ͢Δ
Dangerͱ νʔϜ։ൃͰࡉ͔ͳϧʔϧ͕ଘࡏ͢Δ • WIP͕͍ͭͨ··ϨϏϡʔʹճ͞ͳ͍Ͱʂ • ίʔυมߋͨ͠ΒCHANGELOGsߋ৽ͯ͠ʂ • PRͷ࡞ۀऀΛઃఆͯ͠ʂ • ಛघͳϑΝΠϧ͕ߋ৽͞Ε͍ͯΔͳΒࣄલʹڭ͑ͯ΄͍͠...
etc...
͜ΕΒΛʢਓؒͷΘΓʹʣ ࣄલνΣοΫͯ͘͠ΕΔͷ͕ Danger
Danger ͷछྨ
None
Danger ͷछྨ • ݱࡏ js൛ͱruby൛͕͋Δ • ࠷ۙ swift൛ʢ·ͩβͬΆ͍ʣ͕Ճ͞Εͨ! • iOS
11 / swift 4 ʹͯಈ࡞ • https://github.com/danger/danger-swift ※ ࠓճruby൛ͰΛਐΊ·͢
ಋೖํ๏
ಋೖํ๏ ༻ҙ͢Δͷ • Bundler • ԿΒ͔ͷCI (CircleCI , Bitrize ...)
• Danger௨༻ͷ bot • organization / private repoͷࡍඞཁʹͳΔ
ಋೖํ๏ ͓͓·͔ͳྲྀΕ 1. ϩʔΧϧڥʹDangerΛೖΕΔ 2. GithubʹbotΛઃఆ͢Δ 3. CI্ͰDangerFileΛධՁͰ͖ΔΑ͏ʹηοτ͢Δ
ಋೖํ๏ 1. ϩʔΧϧڥʹDangerΛೖΕΔ
ಋೖํ๏ 1. ϩʔΧϧڥʹDangerΛೖΕΔ • ϓϩδΣΫτԼʹ࣮ͯߦ $ bundle init
ಋೖํ๏ 1. ϩʔΧϧڥʹDangerΛೖΕΔ • ੜ͞ΕͨGemFileʹ gem "danger" Λه $ bundle
install ʢ࣮ߦ࣌ɺରܗࣜʹͯηοτΞοϓΛߦ͑Δ͕ɺͱΓ͋͑ͣ Enter࿈ଧͯ͠Α͍ʣ ➡ Πϯετʔϧޭ͢ΔͱDangerFile͕ੜ͞ΕΔ
ಋೖํ๏ 1. ϩʔΧϧڥʹDangerΛೖΕΔ • ϓϩδΣΫτ্ෆཁͳϑΝΠϧ.gitignoreʹه͓ͯ͘͠ ## danger(use bundler) .bundle/ vendor/
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ ʢOSSͷ߹͜ͷखॱল͍ͯΑ͍Ͱ͢!ʣ • Githubͷ߹machine userΛ༻ҙ͢Δ
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ • ن্ɺmachine user 1ͭͷ organization ʹ͖ͭ1ମͷΈ ͱͳ͍ͬͯΔͷͰҙ
• https://developer.github.com/v3/guides/managing- deploy-keys/#machine-users • machine userͷՃํ๏ • http://www.wikihow.com/Use-Deploy-Keys-on- Github#CreatingaMachineUsersub
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ ʢOSSͷ߹͜ͷखॱল͍ͯΑ͍Ͱ͢!ʣ • Ճ͍ͨ͠private repoʹcollaboratorͱͯ͠ɺbotΛՃ͢ Δ
ಋೖํ๏ 2. GithubʹbotΛઃఆ͢Δ ʢOSSͷ߹ࣗͷΞΧϯτͷtokenΛ࡞Γ·͠ΐ͏!ʣ • botʹDanger༻ͷprivate access tokenΛՃ͢Δ • botͰϩάΠϯ
• Setting -> Personal access tokens -> ʮGenerate new tokenʯԡԼ • ͦͷࡍɺtokenͷݖݶ repos શͯʹνΣοΫ͢Δ͜ͱ
ಋೖํ๏ 3. CI্ͰDangerFileΛධՁͰ͖ΔΑ ͏ʹηοτ͢Δ
ಋೖํ๏ 3. CI্ͰDangerFileΛධՁ Ͱ͖ΔΑ͏ʹηοτ͢Δ • bitriseͷ߹ • ֘ϓϩδΣΫτͷworkflow editorΛ։͘ •
ҙͷҐஔʹʮScriptʯstepΛ৽ نՃ • Script content ʹهड़ɿ
ಋೖํ๏ 3. CI্ͰDangerFileΛධՁ Ͱ͖ΔΑ͏ʹηοτ͢Δ • ઌʹ༻ҙͨ͠bot (OSSͷ߹ࣗ ͷ) ͷ private
access token Λη οτ͢Δ • workflow editorͷʮEnv Varsʯ λϒԡԼ • ʮAdd newʯԡԼ͠ɺ ʮDANGERGITHUBAPI_TOKENʯ ͱ͍͏໊শͰtokenొ
͋ͱɺpull requestΛ࡞ͯ͠ Dangerͷ௨͕ग़ΕOKͰ͢ʂ
None
DangerFileΛΧελϚ Πζ͢Δ
None
DangerFileΛΧελϚΠζ͢Δ • message / warn / fail ͷࡾछͰϢʔβʔʹνΣοΫ༰Λप Ͱ͖Δ •
markdownͰͷهड़Մɿ • markdown("## ࡞ۀதͰ͢") • ಛఆͷίʔυͷdiffΛදࣔ͢Δ͜ͱͰ͖Δ
DangerFileΛΧελϚΠζ͢Δ ڞ௨Ͱ͑ͦ͏ͳνΣοΫɿ # ϚΠϧετʔϯͷνΣοΫ message("ϚΠϧετʔϯ͕ະઃఆͰ͢") unless has_milestone # ࡞ۀऀͷνΣοΫ warn("࡞ۀऀΛΞαΠϯ͠·͠ΐ͏",
sticky: false) unless has_assignee # ϚʔδઌͷνΣοΫ warn("ϚʔδઌΛdevelopʹઃఆ͠·͠ΐ͏") if !github.branch_for_base == "develop" # ߦνΣοΫ warn("500ߦ͑ͯ·͢ɻׂͰ͖ΔͱϕλʔͰ͢Ͷ") if git.lines_of_code > 500
DangerFileΛΧελϚΠζ͢Δ iOS։ൃ༻్ͷνΣοΫɿ # App.xcodeproj/project.pbxproj ͷมߋνΣοΫ message ("`App.xcodeproj/project.pbxproj` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include?
"App.xcodeproj/project.pbxproj" # Cartfile ͷมߋνΣοΫ message ("`Cartfile` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include? "Cartfile" message ("`Cartfile.resolved` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include? "Cartfile.resolved" # Podfile ͷมߋνΣοΫ message ("`Podfile` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include? "Podfile" message ("`Podfile.lock` ͕มߋ͞Ε͍ͯ·͢") if git.modified_files.include? "Podfile.lock"
DangerFileΛΧελϚΠζ͢Δ LGTMɿ # add lgtm pic lgtm.check_lgtm • ʮwarn /
failͰͻ͔͔ͬΒͳ͍࣌ͷΈʯLGTM͞ΕΔ • ͻͱͰϨϏϡʔՄೳ͔Δʂ! • GemFileʹه͕ඞཁɿ gem "danger-lgtm"
DangerFileΛΧελϚΠζ͢Δ ʴα • ެࣜυΩϡϝϯτɺʮSHOW ME SOME DANGERFILESʯʹ ෳྫ͋Γɿ • http://danger.systems/ruby/
Danger Pluginͷಋೖ
Danger Pluginͷಋೖ • ઌͷʮdanger-lgtmʯϓϥάΠϯ • Gemfileʹهड़ͯ͠Πϯετʔϧ͢ΕOK • ެࣜαΠτͰଟհ͞ΕͯΔ • ʮPLUGINSʯͷ߲Λࢀরɿ
• http://danger.systems/ruby/
ྑͦ͞͏ͳDanger Plugin clorox • file header(ॺ໊)ͷܗࣜνΣοΫ • https://github.com/barbosa/danger-clorox todoist •
TODO/FIXMEͷهड़ʹର͠ࡉ͔ͳ௨͕Ͱ͖Δ • https://github.com/hanneskaeufler/danger-todoist
slather • ίʔυΧόϨοδͷՄࢹԽ • https://github.com/BrunoMazzo/Danger-Slather Rubocop • rubocopʹ४ڌͨ͠lintνΣοΫ • https://github.com/ashfurrow/danger-rubocop
DUPLICATELOCALIZABLESTRINGS • Localizable.strings ͷkeyॏෳνΣοΫ • https://github.com/AirHelp/danger- duplicatelocalizablestrings LGTM • https://github.com/leonhartX/danger-lgtm
! Ҏ্ !
ref • http://danger.systems/ • http://sssslide.com/speakerdeck.com/jp_pancake/ dangerwoshi-tuteprwozi-dong-de-nitietukusuru • https://www.slideshare.net/ShunsukeMaeda/dangerpull- request •
http://qiita.com/toshiya/items/589834d9b09c0dbe4c56