octokit.rb
octokit.rb copied to clipboard
[BUG]: Update notification messages to use constant name or github OAuth app name instead of github username in autobot actions
What happened?
-
I have created a GitHub autobot application in Ruby on Rails using Octokit and GitHub OAuth app. In this application, I have used an access token provided by GitHub to generate an instance of the Octokit client.
-
When Octokit performs any GitHub action, such as adding a label, it displays my GitHub username to show notifications on the GitHub UI, like 'anmol-kumar added bug label.' Instead, I would like to display a constant name, 'Autobot' or github OAuth app name, such as 'Autobot added bug label'."
class GithubService
attr_accessor :github_access_token
def initialize(github_access_token)
@github_access_token = github_access_token
end
def client
@_client ||= Octokit::Client.new({bearer_token: github_access_token, auto_paginate: true, user_agent: "Autobot"})
end
def assign_labels(repo_full_name, issue_number, labels)
client.add_labels_to_an_issue(repo_full_name, issue_number, labels)
end
end
- I tried to achieve this by setting user_agent, but GitHub still uses my username instead of 'Autobot'.
Thanks for your help in advance!
Versions
octokit version: 6.0.1 ruby version: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin21]
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Can you describe more about the token you're using and how it's generated?
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!