vital.vim icon indicating copy to clipboard operation
vital.vim copied to clipboard

reviewdog is unstable

Open tyru opened this issue 5 years ago • 3 comments

https://github.com/vim-jp/vital.vim/pull/638#issuecomment-513519422 #683

等で

# Run reviewdog.
reviewdog -reporter=github-pr-check
reviewdog: status=401: The access token not provided. Get token from https://reviewdog.app/gh/vim-jp/vital.vim
The command "if [[ "${RUN_LINT}" == "true" ]] ; then bash scripts/run-lint-on-ci.sh ; fi" exited with 1.

とエラーがが出てます。 https://travis-ci.org/vim-jp/vital.vim/jobs/562415122

#610 で token 再生成した辺りから自分が手順間違えてたとかもありそう…

cc: @haya14busa

tyru avatar Jul 23 '19 07:07 tyru

https://github.com/vim-jp/vital.vim/pull/638#issuecomment-514972992

droneio はもう使ってないので全く関係ないです。 401 Bad credentials がでるのは謎です。 正確に言うとreviewdogのトークンではなく後ろで取得したGitHub API token がなぜかGitHub APIから401にランダムに弾かれてるのでreviewdogトークンを再生成しても意味はありません。

tyru avatar Aug 31 '19 15:08 tyru

GitHub Token 問題 ( #638)

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 が正しく発行されてない可能性があるかと思ってます。ただパッと読んでる現状だとバグは見つけられてません。 最近ライブラリにメンテナがついたっぽくてちょくちょく変わってるのでアップデートするだけで勝手に直るかもしれない(希望的観測すぎる)

https://github.com/bradleyfalzon/ghinstallation/blob/49ae7c59d7434042f18f65355ef9bc6ebefd7738/transport.go#L111-L116

reviewdog token 問題 (#683)

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な気がするのであんまり嬉しくないかもです。

haya14busa avatar Sep 13 '19 14:09 haya14busa

期待age

tyru avatar Sep 13 '19 17:09 tyru