sataga / personal

memo書く用
2 stars 0 forks source link

github app を学ぶ #5

Closed sataga closed 4 years ago

sataga commented 4 years ago

参考URL

内容

sataga commented 4 years ago

node環境がlocalにあったのでやってみる。 リポジトリ名を問われたので一応用意しておく。

(⎈ |minikube:default)[t-sataga@~]
% cd tmp
(⎈ |minikube:default)[t-sataga@~/tmp]
% npx create-probot-app my-first-app
npx: 216個のパッケージを37.707秒でインストールしました。

Let's create a Probot app!
Hit enter to accept the suggestion.

? App name: my-first-app
? Description of app: A Probot app
? Author's full name: sataga
? Author's email address: t.g.s.0928@gmail.com
? Homepage:
? GitHub user or org name: sataga
? Repository name: my-first-app
? Which template would you like to use? basic-js
created file: /Users/t-sataga/tmp/my-first-app/.env.example
created file: /Users/t-sataga/tmp/my-first-app/CODE_OF_CONDUCT.md
created file: /Users/t-sataga/tmp/my-first-app/CONTRIBUTING.md
created file: /Users/t-sataga/tmp/my-first-app/LICENSE
created file: /Users/t-sataga/tmp/my-first-app/README.md
created file: /Users/t-sataga/tmp/my-first-app/app.yml
created file: /Users/t-sataga/tmp/my-first-app/index.js
created file: /Users/t-sataga/tmp/my-first-app/package.json
created file: /Users/t-sataga/tmp/my-first-app/travis.yml
created file: /Users/t-sataga/tmp/my-first-app/test/index.test.js
created file: /Users/t-sataga/tmp/my-first-app/test/fixtures/issues.opened.json
Finished scaffolding files!

Installing Node dependencies!
npm WARN deprecated superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header).  This notice will go away with v5.0.2+ once it is released.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()

> dtrace-provider@0.8.8 install /Users/t-sataga/tmp/my-first-app/node_modules/dtrace-provider
> node-gyp rebuild || node suppress-error.js

  ACTION binding_gyp_ndtp_target_build_ndtp .
  TOUCH Release/obj.target/ndtp.stamp

> fsevents@1.2.9 install /Users/t-sataga/tmp/my-first-app/node_modules/fsevents
> node install

node-pre-gyp WARN Using request for node-pre-gyp https download
[fsevents] Success: "/Users/t-sataga/tmp/my-first-app/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote

> nodemon@1.19.4 postinstall /Users/t-sataga/tmp/my-first-app/node_modules/nodemon
> node bin/postinstall || exit 0

Love nodemon? You can now support the project via the open collective:
 > https://opencollective.com/nodemon/donate

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN acorn-jsx@5.1.0 requires a peer of acorn@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.

added 906 packages from 555 contributors and audited 879363 packages in 121.788s
found 0 vulnerabilities

   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │       New minor version of npm available! 6.4.1 → 6.12.1       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.12.1   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

Done! Enjoy building your Probot app!
(⎈ |minikube:default)[t-sataga@~/tmp]

起動!

(⎈ |minikube:default)[t-sataga@~/tmp/my-first-app]
% npm run dev

> my-first-app@1.0.0 dev /Users/t-sataga/tmp/my-first-app
> nodemon

[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): .env *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `npm start`

> my-first-app@1.0.0 start /Users/t-sataga/tmp/my-first-app
> probot run ./index.js

22:13:31.263Z  INFO probot: Listening on http://localhost:3000
22:13:32.325Z  INFO probot:

  Welcome to Probot! Go to http://localhost:3000 to get started.

22:13:38.411Z  INFO http: GET / 302 - 15.44 ms (id=0f5260b8-128e-4b72-ae7a-c65f7e401da9)
22:13:38.541Z  INFO http: GET /probot 200 - 112.13 ms (id=100a153a-5792-4af0-b081-e19345e4b4bf)
22:13:38.636Z  INFO http: GET /robot.svg 200 - 11.10 ms (id=8f0cd662-e657-4260-a1bf-4eb12099690f)
22:13:38.641Z  INFO http: GET /primer.css 200 - 19.37 ms (id=9f95056e-dc7c-413b-8914-18c01f72023e)
22:13:39.490Z  INFO http: GET /probot-head.png 200 - 4.24 ms (id=41a8d3d5-a478-4ca7-8854-b6f57e91d24d)

localhostにアクセスする image

Register GitHub App を進める image image image image

npm start して、Issue切ったら動いた! image

sataga commented 4 years ago

本家github側で、githubappのインストールを手動で行った際の設定値。 以下は補足メモ。

1ページスクショ ![screencapture-github-settings-apps-new-2019-11-09-06_08_08](https://user-images.githubusercontent.com/24913906/68510632-61205100-02b7-11ea-9dae-f9d9a0b91537.png)
APP_ID
WEBHOOK_SECRET
LOG_LEVEL
WEBHOOK_PROXY_URL

上記の.envの設定もして、$ yarn start を実行したところ、証明書エラーは出なかった。 Issue作成して動くのかどうかを確認

image

sataga commented 4 years ago

会社の環境はGHEで、認証鍵周りがgithubに取りに行くのを止められず断念。