Open tyru opened 5 years ago
https://github.com/vim-jp/vital.vim/pull/638#issuecomment-514972992
droneio はもう使ってないので全く関係ないです。 401 Bad credentials がでるのは謎です。 正確に言うとreviewdogのトークンではなく後ろで取得したGitHub API token がなぜかGitHub APIから401にランダムに弾かれてるのでreviewdogトークンを再生成しても意味はありません。
reviewdog -reporter=github-pr-check
2019/07/22 12:58:58 [vimlint] reported: https://github.com/vim-jp/vital.vim/runs/174319121
2019/07/22 12:58:58 [vint] reported: https://github.com/vim-jp/vital.vim/runs/174319123
2019/07/22 12:58:58 [misspell] reported: https://github.com/vim-jp/vital.vim/runs/174319124
reviewdog: status=400: POST https://api.github.com/repos/vim-jp/vital.vim/check-runs: 401 Bad credentials []
Using an expired token produces a status code of 401 - Unauthorized, and requires creating a new installation token -- https://developer.github.com/v3/apps/#create-a-new-installation-token
一つ今あり得るなぁと思ってるのが token が expire すると401を返すらしいので使っているライブラリ、または自分の使い方の問題で refresh token が正しく発行されてない可能性があるかと思ってます。ただパッと読んでる現状だとバグは見つけられてません。 最近ライブラリにメンテナがついたっぽくてちょくちょく変わってるのでアップデートするだけで勝手に直るかもしれない(希望的観測すぎる)
reviewdog -reporter=github-pr-check
reviewdog: status=401: The access token not provided. Get token from https://reviewdog.app/gh/vim-jp/vital.vim
これはエラー通り REVIEWDOG_TOKEN がありません。 https://github.com/reviewdog/reviewdog#reporter-github-checks--reportergithub-pr-check Travis CI からのリクエストだとなくても動くという codecov を真似たハックがあるんですが IP Address みてやってる推奨されないようなやり方なのでworkerによってはまれに判定をすり抜けてるっぽいと推察してます。
REVIEWDOG_TOKEN を明示的に渡せば解決しますが、travis のencryptionだとforkからのp-rからではtravisの仕様で使えません。REVIEWDOG_TOKEN token をtravisのencryption使わずべた書きするという方法や、circle ci を使うとforkからのp-rでもsecret environment variableを有効化するオプションがあります。
[蛇足] また今現在reviewdog側で開発している GitHub Actions から発行されるGitHub APIトークンから直接GitHubのCheck APIを呼ぶという方法があるのですが、これは fork からの p-rでは一律write権限がないので使えません。forkからのp-rの場合はGitHub Actionsのログにべた書きするというフォールバックはできますが vital.vim 的には基本forkからのp-rな気がするのであんまり嬉しくないかもです。
期待age
https://github.com/vim-jp/vital.vim/pull/638#issuecomment-513519422
683
等で
とエラーがが出てます。 https://travis-ci.org/vim-jp/vital.vim/jobs/562415122
610 で token 再生成した辺りから自分が手順間違えてたとかもありそう…
cc: @haya14busa