Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to automatically set up GITHUB_TOKEN #66

Merged
merged 2 commits into from Sep 1, 2023

Conversation

js2264
Copy link
Contributor

@js2264 js2264 commented Aug 31, 2023

Currently the rworkflows.yml requires a specific "PAT_GITHUB" secret to be set up in each repo using the GHA.
However, GitHub automatically sets up {{ secrets.GITHUB_TOKEN }} for any GHA job, without needing to set it up manually, so this could be used instead of a manually set up "PAT_GITHUB".

This requires adding permissions set for contents: write for any job relying on {{ secrets.GITHUB_TOKEN }}, otherwise JamesIves deploy GHA won't work (see here: https://github.com/JamesIves/github-pages-deploy-action#:~:text=If%20you%20do,permissions%20it%20needs.)

More here: https://docs.github.com/en/actions/security-guides/automatic-token-authentication

@js2264
Copy link
Contributor Author

js2264 commented Aug 31, 2023

Not sure how the checks here work in a PR, and whose secrets they inherit?
I have not actually changed any workflow file (in .github/workflows/), so I doubt the error would be due to my changes? The error seems to be related to a missing GITHUB_PAT for remotes (note, a missing GITHUB_PAT, not the PAT_GITHUB mentioned in the package and in my comment above). I have reverted part of my modifications to retain the storing of this GITHUB_PAT ("GITHUB_PAT=${{ inputs.GITHUB_TOKEN }}"). Maybe I'm missing something else here?

@js2264
Copy link
Contributor Author

js2264 commented Aug 31, 2023

Just to confirm things should work, here is my rworkflows results:

The only commit in-between, with only changes to the yml: js2264/plyinteractions@dc2e62a

And AFAIK I have no secret set up for this repo.

@bschilder
Copy link
Collaborator

bschilder commented Sep 1, 2023

Thanks so much for the PR @js2264 , this has been a point of confusion for me for a long time. Ideally I'd like to get rid of any additional setup steps outside of the rworkflows::use_workflow function, so this would definitely be a step towards that. Let me double check what's going on with the checks and I'll get back to you ASAP.

Also thanks for being an early adopter of rworkflows! I've seen you're using it in a number of your packages. If you have any other PRs/suggestions/feature requests do let me know and I'd be happy to work with you to make it happen.

All the best,
Brian

@bschilder bschilder self-assigned this Sep 1, 2023
@bschilder bschilder added enhancement New feature or request GitHub Actions Issue occurring on GitHub Actions labels Sep 1, 2023
@bschilder
Copy link
Collaborator

Oh also, I'm going to try to switch this PR to the dev branch, so that we can play around with these changes without affecting other users just yet. The dev branch will then be run using this workflow:
https://github.com/neurogenomics/rworkflows/blob/master/.github/workflows/rworkflows_dev.yml

@bschilder bschilder changed the base branch from master to dev September 1, 2023 10:06
@bschilder bschilder merged commit 2a2224e into neurogenomics:dev Sep 1, 2023
0 of 9 checks passed
@js2264
Copy link
Contributor Author

js2264 commented Sep 1, 2023

@bschilder
Copy link
Collaborator

🎉🎉 https://github.com/neurogenomics/rworkflows/actions/runs/6048293406/job/16413370380

Awesome work @js2264 , everything is now merged and working great. This goes a long way towards making rworkflows even easier to use!

Thanks again,
Brian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request GitHub Actions Issue occurring on GitHub Actions
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants