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

Implement archive/unarchive functionality #472

Closed
joaoe opened this issue Nov 20, 2018 · 10 comments
Closed

Implement archive/unarchive functionality #472

joaoe opened this issue Nov 20, 2018 · 10 comments

Comments

@joaoe
Copy link
Contributor

joaoe commented Nov 20, 2018

Howdy.

GHRepository does not have an archive/unarchive feature.

To archive, a GitHub.edit("archived", "true") call is enough.

To unarchive, it is not possible from the REST API and need to be done manually in the web UI.

In case someone wants to implement an unarchive API:
send a POST request to https://github.com/<organization>/<repository>/settings/archive or https://github.com/<organization>/<repository>/settings/unarchive. The POST body contains:
utf8=%E2%9C%93&authenticity_token=...&verify=<repository>. The token authenticity_token is embedded in the HTML in the html form.
This will force to use a different set of URLs and scrape some HTML, so lets consider this out of scope.

@andrewlalis
Copy link

would it not be more intuitive to name the method simply archive?

@joaoe
Copy link
Contributor Author

joaoe commented Nov 26, 2018

Hi. Could be, but archive is both a verb and a noun so for me at least, naming something as archive looks confusing. There are some options of verbs to use here, like do or set, or name it as archiveRepository.

@andrewlalis
Copy link

I think that if we want to be very explicit, the most java-style way to do it would be setArchived(boolean isArchived)

@joaoe
Copy link
Contributor Author

joaoe commented Dec 16, 2018

Hi again. Been a bit away.

Are you one of the project maintainers ?

@andrewlalis
Copy link

No, sadly I'm just someone who is interested in having this functionality implemented.

@TV4Fun
Copy link

TV4Fun commented May 17, 2019

+1. This would be very nice to have.

@bitwiseman
Copy link
Member

@joaoe @TV4Fun
I've commented on #473. If you're interested, please update the PR to address the comments and we can get this merged.

@bitwiseman
Copy link
Member

I changed the method name to archive() and added a test for it.
This will be in the next version, which should be released in the next few weeks.

@lumaxis
Copy link

lumaxis commented Mar 1, 2023

Just coincidentally found this and wanted to leave a note that unarchiving via API is now possible: https://github.blog/changelog/2022-12-13-unarchive-a-repository-via-the-rest-api/

@bitwiseman
Copy link
Member

@lumaxis
Could you open a new issue asking for unarchive functionality to be added?

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

No branches or pull requests

5 participants