gistr icon indicating copy to clipboard operation
gistr copied to clipboard

fix PAT issue in GHA

Open maelle opened this issue 3 years ago • 2 comments

@ScientificProgrammer I can help with this if needed! The tests are failing (my fault, I should have foreseen this) because they use the default GitHub Personal Access Token for the actions as opposed to one with gist scope.

Easy workaround

What's needed

  • creating a GitHub PAT with the correct scopes for this package (including gist scope). Hopefully you can create a fine-grained one https://github.blog/2022-10-18-introducing-fine-grained-personal-access-tokens-for-github/
  • storing it in https://github.com/ropensci/gistr/settings/secrets/actions as MY_GITHUB_PAT (existing PATs there have probably expired now). Once it's there no one can view it, we admins can only renew it, and everyone with write access to this repository can use it in the GitHub Actions workflow.
  • in the GitHub Actions workflow referring to it, replacing

https://github.com/ropensci/gistr/blob/61f2003a539bc7b08750c451b087a36b316c6a2e/.github/workflows/R-CMD-check.yaml#L28

with

GITHUB_PAT: ${{ secrets.MY_GITHUB_PAT }}

Better solution

Making the tests independent from a personal access token using tools from https://books.ropensci.org/http-testing/ -- we could collaborate on this. This is a better solution because it'd mean tests also pass when launched from an external fork in a pull request.

maelle avatar Oct 21 '22 05:10 maelle

Hi Maelle,

I want to collaborate with you on the better solution, which is independent of a PAT.

However, as a short term solution, should I go ahead and create a PAT with fine grained permissions, since I'm familiar with that process? If so, should I create one each for you and me?

ScientificProgrammer avatar Oct 21 '22 16:10 ScientificProgrammer

Yes it sounds reasonable as a short term solution to create one for you and one for the repo settings (I use my own PAT locally). :-)

maelle avatar Oct 21 '22 16:10 maelle