Is it possible to add GitHub Apps Bot to CODEOWNERS?

Hi, there

I wanna add my GitHub Apps bot to CODEOWNERS to automate approval processes.

I’ve already tried to do it like following, but not work.

/example-path @our-githubapps-bot-name  

The bot has access to the repository with read&write permission.

Is it possible to add the bot to CODEOWNERS or not? 

If possible, how can I define CODEOWNERS?

1 Like

Hi @0gajun,

Thank you for being here! Currently, GitHub Apps can’t be used in CODEOWNERS – that’s not supported. It’s something the team is considering for the future, and I’ll be sure to add your use case to the internal feature request.

I wrote a github app to merge code automatically if it passes CI checks and meets certain criteria that would designate the PR as a minimal change. For more involved changes, we do want owners to approve. It works in my test repo, but the repo I installed it on eventually has a CODEOWNERS file. When the app attempts to merge, I get an error message as shown below, even though it has merge access. There doesn’t seem to be any way to override this message, and this response is completely undocumented. Between this and github actions, I’ve had multiple mishaps and re-writes that I’ve had to do that have resulted in around 1-2 weeks of lost time on this project, primarily due to documentation issues and frankly bugs on what the docs say github supports. It would be nice if this stuff would work as documented and if bots with merge access wouldn’t get error messages back saying they can’t merge. Even just a force parameter to override the error message would give me what I need, but that doesn’t appear to exist.

# with merge bot (github app) token
$ curl -X PUT -H “Authorization: Bearer $INSTALL_TOKEN” -H “Accept: application/vnd.github.machine-man-preview+json” -H ‘Content-Type: application/json’ ‘https://api.github.com/repos/my-repo/pulls/234/merge
-d ‘{
“commit_title”: “test merge by manually calling github API”,
“commit_message”: “Test commit”,
“merge_method”: “merge”
}’ | python -m ‘json.tool’
{
“message”: “Waiting on code owner review from <owner>”,
“documentation_url”: “https://help.github.com/articles/about-protected-branches
}

# with user API token
curl -X PUT -H “Authorization: Bearer $GITHUB_TOKEN” -H “Accept: application/vnd.github.machine-man-preview+json” -H ‘Content-Type: application/json’ ‘https://api.github.com/repos/my-repo/pulls/234/merge’ -d ‘{
“commit_title”: “test merge by manually calling github API”,
“commit_message”: “Test commit”,
“merge_method”: “merge”
}’ | python -m ‘json.tool’
{
“sha”: “<sha>”,
“merged”: true,
“message”: “Pull Request successfully merged”
}