Skip to content

feat(server): add fallback to GITHUB_TOKEN if installation token fails#1887

Merged
krzema12 merged 2 commits intomainfrom
1880-chore-add-fallback-to-personal-access-token-if-installation-access-token-fails-for-whichever-reason
Apr 5, 2025
Merged

feat(server): add fallback to GITHUB_TOKEN if installation token fails#1887
krzema12 merged 2 commits intomainfrom
1880-chore-add-fallback-to-personal-access-token-if-installation-access-token-fails-for-whichever-reason

Conversation

@LeoColman
Copy link
Copy Markdown
Member

  • Attempts to retrieve a GitHub App Installation token first
  • Falls back to GITHUB_TOKEN if the installation token fails
  • Logs a warning on failure of installation token retrieval
  • Updated KDocs for both getGithubAuthToken and getGithubAuthTokenOrNull

This comment was marked as resolved.

@LeoColman
Copy link
Copy Markdown
Member Author

@krzema12

We're missing adding a metric to count the amount of failures.

The problem is: We don't have access to Prometheus registry here, so it's not trivial to create a Counter

Should we move Prometheus to the Common module? Should we add a onFailure: () -> Unit parameter in order to inject a counter.inccrement()?

@krzema12
Copy link
Copy Markdown
Member

krzema12 commented Apr 5, 2025

@LeoColman for now I'd rather do it with the callback, to depend on Prometheus only in the server module.

@LeoColman
Copy link
Copy Markdown
Member Author

@krzema12 Taking a closer look makes me think that won't be possible.

getGithubAuthToken is used on modules:

  • jitbindingserver
  • action-updates-checker

So we either give up on metrics for a specific module or we move the prometheus config

- Attempts to retrieve a GitHub App Installation token first
- Falls back to GITHUB_TOKEN if the installation token fails
- Logs a warning on failure of installation token retrieval
- Updated KDocs for both getGithubAuthToken and getGithubAuthTokenOrNull
@LeoColman LeoColman force-pushed the 1880-chore-add-fallback-to-personal-access-token-if-installation-access-token-fails-for-whichever-reason branch from 90306be to f13a8cf Compare April 5, 2025 18:16
Copy link
Copy Markdown
Member

@krzema12 krzema12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 🙇

@krzema12 krzema12 merged commit 396d61b into main Apr 5, 2025
16 checks passed
@krzema12 krzema12 deleted the 1880-chore-add-fallback-to-personal-access-token-if-installation-access-token-fails-for-whichever-reason branch April 5, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants