metanorma / ci

Build scripts for Metanorma, works with continuous integration
3 stars 2 forks source link

METANORMA_CI_PAT_TOKEN token, Repository not found, OR token has insufficient permissions. #61

Closed CAMOBAP closed 3 years ago

CAMOBAP commented 3 years ago

@ronaldtse could you please check if there is some restrictions where METANORMA_CI_PAT_TOKEN can be used

ronaldtse commented 3 years ago

@CAMOBAP the token is indeed available for use in the repository. It allows read/write of repos. Any further permissions needed?

CAMOBAP commented 3 years ago

@ronaldtse for some reason it works for metanrorma-cli repo https://github.com/metanorma/metanorma/pull/168/checks?check_run_id=2101819540, but doesn't work for other repos, for example, metanorma https://github.com/metanorma/metanorma/pull/168/checks?check_run_id=2101819540

I will continue investigation

ronaldtse commented 3 years ago

@CAMOBAP maybe this is because there is no secret provided in PRs -- only branches can use those secrets?

CAMOBAP commented 3 years ago

@ronaldtse https://github.com/metanorma/metanorma/pull/168/checks?check_run_id=2101819540 - also PR but it works

CAMOBAP commented 3 years ago

@ronaldtse could you please run

curl -H "Authorization: token ${METANORMA_CI_PAT_TOKEN}" -H 'Accept: application/vnd.github.everest-preview+json' "https://api.github.com/repos/metanorma/metanorma/dispatches" -d '{"event_type": "notify", "client_payload": {}}

With the actual value of METANORMA_CI_PAT_TOKEN, could you please show me the output of this command

ronaldtse commented 3 years ago
{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-repository-dispatch-event"
}
CAMOBAP commented 3 years ago

Hmm, @ronaldtse will the same curls works for metanorma-cli

curl -H "Authorization: token ${METANORMA_CI_PAT_TOKEN}" -H 'Accept: application/vnd.github.everest-preview+json' "https://api.github.com/repos/metanorma/metanorma-cli/dispatches" -d '{"event_type": "notify", "client_payload": {}}

ronaldtse commented 3 years ago

@CAMOBAP I just tried again and it works now!

CAMOBAP commented 3 years ago

@ronaldtse so both metanorma and metanorma-cli works for you, right?

CAMOBAP commented 3 years ago

Looks like it works now

CAMOBAP commented 3 years ago

Hmm, actually it works for all other repositories except metanorma/metanorma really strange(

ronaldtse commented 3 years ago

@camobap now that you say it, maybe it's about the metanorma/metanorma repo. Indeed, it was lacking access for @metanorma/ci ... now it's in. Thanks for finding that out!

CAMOBAP commented 3 years ago

Works now https://github.com/metanorma/metanorma/pull/169/checks?check_run_id=2119463190