GitHub Probot
Probot
Auth
bot 권한을 가지고 쓰기 명령을 실행하려면
APP_IDPRIVATE_KEYorPRIVATE_KEY_PATH
가 있으면 됩니다.
GitHub 일부 기능은 bot이 수행할 수 없는 작업이 있습니다. 이런 경우에는 GITHUB Personal Access Token을 사용해야 합니다. src/main.ts는
GITHUB_TOKEN
환경 변수를 읽을 수 있도록 수정된 코드입니다.
경고
https://github.com/probot/probot/blob/7b09369f4b417f9fc60ca0bcea5678b5169a3421/src/octokit/get-probot-octokit-with-defaults.ts#L31-L40 코드를 보면 GITHUB_TOKEN을 설정한 경우 APP_ID를 무시하도록 되어 있기 때문에 주의해야합니다.
Event
- Pull Request
- Open:
pull_request.opened - Draft -> Ready for review:
pull_request.ready_for_review
- Open:
GitHub App
Settings -> Developer settings -> GitHub Apps -> New GitHub App
GitHub App nameHomepage URLWebhook URL: Probot이 실행 되는 서버의 URLWebhook secret: GitHub에서 Probot으로 웹훅을 보낼 때 생성되는 해시 서명을 위한 시크릿으로 아무 값이나 입력하면 됩니다.X-Hub-Signature-256: 해시 서명 헤더 (sha256=<hexdigest>)
Permissions: 접근 권한을 선택하면 해당하는 이벤트 목록이Subscribe to events에 추가됩니다.Subscribe to events
정보
아래 명령어를 통해 <hexdigest>를 구해볼 수 있습니다.
openssl dgst -sha256 -hmac <secret> -hex <body file>
경고
App을 생성하고 등록한 후 권한을 변경하면 등록한 곳에서 권한 변경에 대한 승인을 해야 적용됩니다.
등록
https://github.com/apps/<appName> -> Install
등록 후에는
- 개인: Settings -> Applications -> Installed GitHub Apps
- Organization: Settings -> GitHub Apps -> Installed GitHub Apps
에서 확인 가능합니다.
Test
smee.io
- https://smee.io/
- strat a new channel
- GitHub
- Settings -> Developer settings -> GitHub Apps ->
<bot>-> Edit -> GeneralWebhook URL:https://smee.io/<channel>
- Settings -> Developer settings -> GitHub Apps ->
- Probot
WEBHOOK_PROXY_URL=https://smee.io/<channel>환경 변수를 설정
Simulation
Settings -> Developer settings -> GitHub Apps -> <bot> -> Edit -> Advanced