github-action icon indicating copy to clipboard operation
github-action copied to clipboard

[Question] Why use GITHUB_TOKEN as repo_token?

Open changhuixu opened this issue 6 years ago • 8 comments

https://docs.coveralls.io/parallel-build-webhook In the API reference page, the format of API call is like the following

curl -k $COVERALLS_ENDPOINT/webhook?repo_token=$COVERALLS_REPO_TOKEN 
     -d "payload[build_num]=$BUILD_NUMBER&payload[status]=done"

I don't understand why in this github-action, we can use GITHUB_TOKEN instead of the REPO_TOKEN in the coveralls.io repository page? Could you explain to us? Thank you.

changhuixu avatar Nov 14 '19 15:11 changhuixu

It doesn't need to be "GITHUB_TOKEN". It's whatever name you assign it as a Github Secret. The example just uses "GITHUB_TOKEN" but you are welcome to use whatever name you want.

jamesdh avatar Nov 18 '19 15:11 jamesdh

Hi @jamesdh , I guess you misunderstood my question... In other words, what's the role of "COVERALLS_REPO_TOKEN" generated by coveralls.io?

changhuixu avatar Nov 19 '19 01:11 changhuixu

It's your Coveralls API token. You need it to verify who you are with Coveralls. Without it, they don't know who you are pushing data to them as.

jamesdh avatar Nov 19 '19 18:11 jamesdh

It's the same thing as "REPO_TOKEN". You can give it whatever name you want. It's just a variable name. The only thing that matters is the value of the token it contains.

jamesdh avatar Nov 19 '19 18:11 jamesdh

Right. But "COVERALLS_REPO_TOKEN" doesn't have the same value as my "GITHUB_TOKEN".

changhuixu avatar Nov 19 '19 22:11 changhuixu

I have the same question and maybe can clarify what (I think) @changhuixu was asking — why does passing the GITHUB_TOKEN provided by GitHub Actions work as the COVERALLS_REPO_TOKEN?

Based on how I'm reading the API reference this token eventually gets passed as repo_token and that should be coming from Coveralls, not GitHub.

rdmurphy avatar Dec 02 '19 06:12 rdmurphy

@jamesdh Which GitHub API endpoint does Coveralls use to verify who you are? That will tell me what permissions are required.

chrismwendt avatar Dec 03 '19 02:12 chrismwendt

I was curious about this question so I tested out coveralls API: https://docs.coveralls.io/api-reference

When the service_name field is passed as github then coveralls expects the repo_token field to be a github token so that it can directly call back to github. In fact, in such a case, using a legit coveralls repo token will result in a failure unless the service_name field is changed to something else.

Here's an example for how I am using this action for parallel-finished in tandem with the python-coveralls: https://github.com/praw-dev/prawtools/commit/bb0e00b89a899fb2494cf230c0104746ddaeb098

bboe avatar Jan 05 '20 06:01 bboe