-
Notifications
You must be signed in to change notification settings - Fork 75
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
Separate Bot User GitHub Tokens from regro GitHub Tokens #3326
Conversation
env: | ||
BOT_TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed BOT_TOKEN
for install_bot_code.sh
entirely everywhere because I could not find where it uses the token.
@@ -81,7 +80,7 @@ jobs: | |||
export RUN_URL="https://github.com/regro/cf-scripts/actions/runs/${RUN_ID}" | |||
conda-forge-tick deploy-to-github | |||
env: | |||
BOT_TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation: This only pushes to cf-graph so the permissions for regro are sufficient
2867340
to
d9f91ee
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3326 +/- ##
==========================================
- Coverage 76.42% 76.40% -0.03%
==========================================
Files 130 130
Lines 14234 14255 +21
==========================================
+ Hits 10879 10891 +12
- Misses 3355 3364 +9 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow the need for this change. I thought the plan was to put testing feedstocks in the regro
org directly and let the bot fork them, in which case we can use one token and things are a lot simpler.
I know we talked about this already so sorry if I confused you. The test environment needs three things:
It is possible to put the mock cf-graph (1) in Mock feedstocks or forks thereof (2/3) should not be put in Even if the mock graph is put into regro, 2 and 3 require that there is a separation between actions on the bot user account and |
It seems a lot easier to start with something simpler. Making and then deleting repos for running the tests is slow and error prone. We can post some notes on how to set things up and do most of it by hand. |
Automatic test environment creation is already implemented. And it's surely not a bad thing that testing is as much automated as possible. Did not see that anything is slow or raises errors. So I'd appreciate if this PR moves forward. |
Converting to draft because a GitHub app could solve this issue in another way. |
We decided to use a classic PAT for now, although GitHub discourages their usage, making this PR redundant. There are reasons though why we want to migrate the bot to use GitHub app authentication eventually. |
The bot cannot fully use a GitHub app due to GitHub apps not being able to fork feedstocks. We manage a mix of apps and machine users on conda-forge and it is a pain. The only reason we do it there is for the increased api request limits. If we do not need those limits here, then the complexity is not worth it. |
I double-checked and found that GitHub apps indeed can't be used to fork repositories into a user account, but I could successfully fork into an organization if the app is installed in an organization. It requires the original repo to be public, but this should not be a concern for us. Nothing should speak against I agree that the increased rate limits are the main reason why we should consider using a GitHub app. |
The bot is going to remain a machine user and not be changed to an org. |
Description:
Our proposed integration tests for #261 need to interact with the GitHub API with multiple different identities in a staging environment. Since nowadays, fine-grained personal access tokens are recommended by GitHub whenever possible, they clearly separate access to different GitHub users/organizations.
This means the bot needs to support using different access tokens depending on which GitHub user/org it is interacting with. This PR contributes the necessary changes.
Essentially,
BOT_TOKEN
can now be filled with a fine-grained access token forregro-cf-autotick-bot
andREGRO_TOKEN
with a fine-grained token forregro
.Note that these changes do not prevent from continuing to run the bot with a classic access token in production.
I carefully reviewed the source code to verify that the correct tokens are available and used everywhere. It would be helpful if you, @beckermr, could double-check.
I leave it up to you if you also want to update the production tokens to fine-grained tokens together with these changes. It involves more risk of breaking the bot but would ensure that future source code changes correctly differentiate between the two tokens. We can also wait for the integration tests to have more assurance here.
@pavelzw
Checklist:
Cross-refs, links to issues, etc: