403 forbidden error while updating archived repos

I’m facing 403 forbidden error while updating visibility state of archived repos using GitHub API although my personal access token has all the scopes included. However this works fine with my other unarchived repos.

I couldn’t find anything related to this context mentioned in GitHub documentation as well. Any pointers or help in this regard is appreciated.

:wave: Welcome!

According to the API documentation for Update a Repository: archived while you can archive a repository using the API, you can’t unarchive a repository, which would be necessary before any changes can be made to an archived repository, including visibility.

You can of course un-archive a repository using the website in the archived repository’s settings.

Hi @tgnanakumar, I was able to both archive and unarchive a repository using the following GitHub GraphQL APIs, which may allow you to do what your want programmatically, by first archiving the repository, changing visibility as needed and then arching once again,
unarchiverepository
archiverepository

@canuckjacq, I was able to change using the GUI an archived repositories visibility between ‘public’ and ‘private’ whilst it was still archived, this surprised me as its says “This repository has been archived by the owner. It is now read-only.”, it is also inconsistent with the REST API 403 forbidden error mentioned mentioned in this topic, not sure why the GUI and API should behave differently in these circumstances?

1 Like

Thanks @byrneh for letting me know the possibility of doing it using GraphQL API! I’ll check it out.