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

feat: Added GitHub app authentication #97

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

galbirk
Copy link
Contributor

@galbirk galbirk commented May 21, 2023

In this PR I added the feature of authenticating to GitHub API with github app and allowing to fetch metrics about it.

Tests:

$ make test                                                                                                                     
?       github.com/infinityworks/github-exporter        [no test files]
?       github.com/infinityworks/github-exporter/config [no test files]
?       github.com/infinityworks/github-exporter/exporter       [no test files]
?       github.com/infinityworks/github-exporter/http   [no test files]
=== RUN   TestHomepage
Created sequence diagram (2641264843_2166136261.html): /Users/galbirkman/projects/github-exporter/test/.sequence/2641264843_2166136261.html
--- PASS: TestHomepage (0.01s)
=== RUN   TestGithubExporter
time="2023-05-21T16:30:35+03:00" level=info msg="Fetching https://api.github.com/repos/myOrg/myRepo?per_page=100 \n"
time="2023-05-21T16:30:35+03:00" level=info msg="Fetching https://api.github.com/repos/myOrg/myRepo/releases \n"
time="2023-05-21T16:30:35+03:00" level=info msg="Fetching https://api.github.com/repos/myOrg/myRepo/pulls \n"
time="2023-05-21T16:30:35+03:00" level=info msg="API data fetched for repository: https://api.github.com/repos/myOrg/myRepo?per_page=100"
time="2023-05-21T16:30:35+03:00" level=info msg="All Metrics successfully collected"
Created sequence diagram (31181356_2166136261.html): /Users/galbirkman/projects/github-exporter/test/.sequence/31181356_2166136261.html
--- PASS: TestGithubExporter (0.07s)
PASS
ok      github.com/infinityworks/github-exporter/test   1.388s

Closes #95

@ben-z
Copy link

ben-z commented Apr 2, 2024

@henrymcconville can we merge this PR? Would love to have this feature.

Copy link
Collaborator

@henrymcconville henrymcconville left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I've marked one of my comments IMPORTANT and added a few minor nitpicks that would be good to address but aren't critical. Would you also be able to rebase off the master branch to resolve the conflicts in config.go and go.sum. Thanks!

exporter/prometheus.go Outdated Show resolved Hide resolved
exporter/prometheus.go Outdated Show resolved Hide resolved
exporter/prometheus.go Outdated Show resolved Hide resolved
exporter/prometheus.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
exporter/prometheus.go Outdated Show resolved Hide resolved
@galbirk
Copy link
Contributor Author

galbirk commented Apr 3, 2024

Thanks @henrymcconville !
Will take a look and update. Hopefully in the next few days.

@galbirk
Copy link
Contributor Author

galbirk commented Apr 8, 2024

@henrymcconville I removed duplicated code and added some fields to the Config struct.
I was thinking to create GitHubApp struct specifically for GitHubApp configuration to not overload the Config one. WDYT? For now, all added to the Config struct.

config/config.go Outdated Show resolved Hide resolved
@henrymcconville henrymcconville self-requested a review April 23, 2024 10:46
@henrymcconville
Copy link
Collaborator

@galbirk Think a separate struct would be nicer but happy with it as is for now. Feel free to raise a follow up PR if you're passionate enough about it being separated 😄

@henrymcconville henrymcconville merged commit d667f9a into githubexporter:master Apr 23, 2024
1 check passed
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.

Enable github app authentication
4 participants