Enabling/Disabling GitHub Issues via the GitHub API
I recently needed to toggle whether GitHub Issues is enabled for a number of repositories, and wanted to automate it.
Searching through the GitHub docs I couldn't find anything super explicit, aside from a UI-driven configuration.
Thankfully one of my colleagues pointed me to the Update a repo functionality, which includes the ability to specify PATCHing the has_issues
field.
For instance, using the gh
CLI:
# enable Issues
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
/repos/jamietanna/oapi-codegen \
-F has_issues=true
# disable Issues
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
/repos/jamietanna/oapi-codegen \
-F has_issues=false