-
Notifications
You must be signed in to change notification settings - Fork 24
ci: migrate pypi_publish workflow from PAT to octavia-bot GitHub App #607
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
base: main
Are you sure you want to change the base?
Conversation
- Replace GH_PAT_MAINTENANCE_OCTAVIA with octavia-bot GitHub App authentication - Add two GitHub App token generation steps using actions/create-github-app-token@v2 - Generate tokens immediately before each usage to avoid 1-hour expiration - Update checkout and create-pull-request steps to use generated tokens - Resolves PAT rate limit issues by using GitHub App tokens Co-Authored-By: AJ Steers <aj@airbyte.io>
Original prompt from AJ Steers:
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Fix reference from removed get-pr-token step to existing get-checkout-token step - Ensures workflow doesn't fail when trying to create PR with non-existent token Co-Authored-By: AJ Steers <aj@airbyte.io>
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.
✅ Approved. This matches the existing proven patterns of using GitHub App token instead of a PAT, and should permanently resolve the rate limit issue that we've seen on this workflow.
@aaronsteers catching up here and this makes sense to me. What is the history behind having a GH app for some jobs and this maintenance PAT for other jobs? I saw your concern about expiring GH tokens for long-running jobs. It seems like the GH action we use to get the token from the GH app doesn't handle refreshing automatically but we shouldn't care about that here since the steps of this job should be fast. Is that right? |
@dbgold17 - The PAT method is a bit older and simpler than the GitHub App auth approach, but GitHub App is recommended as the best practice for most use cases, and GitHub advises using a GitHub App instead of a PAT for all automation use cases. Also, GitHub Apps have 3x of the hourly rate limit (15K instead of 5K requests). When I submitted the help ticket to GitHub Support requesting a rate limit, they advised about this difference and suggested migrating to GitHub App. There's a few other advantages as well, but long story short: we can and probably should just eventually migrate everything from PAT to GitHub App. Caveats:
Yes, that's correct. See my note above. The vast majority of our jobs don't take an hour to complete, so this isn't going to be an issue for most cases. Just something to keep in mind. The best practice though, for the edge case where a single operation might take longer than an hour, is to redesign the step to accept client ID and client secret, and then have the step itself get its own token as needed. Since most actions don't take that long, most actions are still fine to just accept a token - but wanted to lay this out for completeness. |
I also put a lot of this extra context in the issue: |
More info:
Migrate pypi_publish workflow from PAT to octavia-bot GitHub App
This PR migrates the
pypi_publish.yml
workflow from using the "Octavia Maintenance" PAT (GH_PAT_MAINTENANCE_OCTAVIA
) to theoctavia-bot
GitHub App authentication. This resolves PAT rate limit failures by using GitHub App tokens which have higher rate limits and are more secure.Changes Made
actions/create-github-app-token@v2
Technical Details
Token Lifetime Management
Following feedback about GitHub App token limitations, this implementation generates tokens twice:
get-checkout-token
for accessing airbyte-platform-internal repositoryget-pr-token
for creating pull requestsThis ensures we never hit the 1-hour expiration limit even if the workflow takes a long time between these steps.
Implementation Pattern
actions/create-github-app-token@v2
(following PyAirbyte pattern)airbyte-platform-internal
repositoryOCTAVIA_BOT_APP_ID
andOCTAVIA_BOT_PRIVATE_KEY
secretsBenefits
Comprehensive List of Workflows Using "Octavia Maintenance" PAT
Based on my analysis across all three repositories, here are all workflows currently using
GH_PAT_MAINTENANCE_OCTAVIA
:airbytehq/airbyte
.github/workflows/poe-command.yml
(line 50).github/workflows/slash-commands.yml
(line 21).github/workflows/bump-version-command.yml
(line 97).github/workflows/label-prs-by-context.yml
(lines 16, 19).github/workflows/label-github-issues-by-context.yml
(lines 14, 17).github/workflows/stale-community-issues.yaml
(line 27).github/workflows/stale-routed-issues.yaml
(line 25)airbytehq/airbyte-python-cdk
.github/workflows/pypi_publish.yml
(lines 282, 305) - ✅ MIGRATED IN THIS PR.github/workflows/poe-command.yml
(line 28).github/workflows/slash_command_dispatch.yml
(line 18)airbytehq/PyAirbyte
.github/workflows/slash_command_dispatch.yml
(line 22)Testing
The workflow changes have been validated for:
Link to Devin run
https://app.devin.ai/sessions/dab84139d9d74eafa65ab285f12ccd39
Requested by: AJ Steers (aj@airbyte.io)