Skip to content

Commit

Permalink
GHAE deletion packages follow-up (github#23442)
Browse files Browse the repository at this point in the history
* Add placeholder for now

* No longer need to version for GHAE

* Make article appear for GHAE version

* Update versioning for this article

* Fix broken link

* Update release note for GHAE

* Update versioning based on input

* Clean-up for CI tests

* I love markdown and markdown loves . . .

* All is restored

* Fix CI broken link

* Remove ghae versioning for "Deleting a package" link

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Steve Guntrip <[email protected]>

Co-authored-by: “jmarlena” <“[email protected]”>
Co-authored-by: Steve Guntrip <[email protected]>
  • Loading branch information
3 people authored Jan 5, 2022
1 parent 9bdbec7 commit d3f1cf8
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ The repository owner has full control of the repository. In addition to the acti
| Limit interactions with the repository | "[Limiting interactions in your repository](/communities/moderating-comments-and-conversations/limiting-interactions-in-your-repository)" |{% endif %}{% ifversion fpt or ghes > 3.0 or ghae or ghec %}
| Rename a branch, including the default branch | "[Renaming a branch](/github/administering-a-repository/renaming-a-branch)" |{% endif %}
| Merge a pull request on a protected branch, even if there are no approving reviews | "[About protected branches](/github/administering-a-repository/about-protected-branches)" |
| Delete the repository | "[Deleting a repository](/github/administering-a-repository/deleting-a-repository)" |
| Delete the repository | "[Deleting a repository](/repositories/creating-and-managing-repositories/deleting-a-repository)" |
| Manage the repository's topics | "[Classifying your repository with topics](/github/administering-a-repository/classifying-your-repository-with-topics)" |{% ifversion fpt or ghec %}
| Manage security and analysis settings for the repository | "[Managing security and analysis settings for your repository](/github/administering-a-repository/managing-security-and-analysis-settings-for-your-repository)" |{% endif %}{% ifversion fpt or ghec %}
| Enable the dependency graph for a private repository | "[Exploring the dependencies of a repository](/github/visualizing-repository-data-with-graphs/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository)" |{% endif %}{% ifversion fpt or ghes > 3.0 or ghec %}
| Delete and restore packages | "[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package)" |{% endif %}{% ifversion ghes = 3.0 or ghae %}
| Enable the dependency graph for a private repository | "[Exploring the dependencies of a repository](/github/visualizing-repository-data-with-graphs/exploring-the-dependencies-of-a-repository#enabling-and-disabling-the-dependency-graph-for-a-private-repository)" |{% endif %}{% ifversion fpt or ghes > 3.1 or ghec or ghae %}
| Delete and restore packages | "[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package)" |{% endif %}{% ifversion ghes < 3.1 %}
| Delete packages | "[Deleting packages](/packages/learn-github-packages/deleting-a-package)" |{% endif %}
| Customize the repository's social media preview | "[Customizing your repository's social media preview](/github/administering-a-repository/customizing-your-repositorys-social-media-preview)" |
| Create a template from the repository | "[Creating a template repository](/github/creating-cloning-and-archiving-repositories/creating-a-template-repository)" |{% ifversion fpt or ghes or ghae-issue-4864 or ghec %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Name | Description
&emsp;`read:discussion` | Allows read access for team discussions.{% ifversion fpt or ghae or ghec %}
**`write:packages`** | Grants access to upload or publish a package in {% data variables.product.prodname_registry %}. For more information, see "[Publishing a package](/github/managing-packages-with-github-packages/publishing-a-package)".
**`read:packages`** | Grants access to download or install packages from {% data variables.product.prodname_registry %}. For more information, see "[Installing a package](/github/managing-packages-with-github-packages/installing-a-package)".
**`delete:packages`** | Grants access to delete packages from {% data variables.product.prodname_registry %}. For more information, see "{% ifversion fpt or ghes > 3.0 or ghec %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 or ghae %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}."{% endif %}
**`delete:packages`** | Grants access to delete packages from {% data variables.product.prodname_registry %}. For more information, see "{% ifversion fpt or ghes > 3.0 or ghec or ghae %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}."{% endif %}
**`admin:gpg_key`** | Fully manage GPG keys.
&emsp;`write:gpg_key`| Create, list, and view details for GPG keys.
&emsp;`read:gpg_key`| List and view details for GPG keys.{% ifversion fpt or ghec %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Some of the features listed below are limited to organizations using {% data var
| Edit a repository's description | | | | **X** | **X** |{% ifversion fpt or ghae or ghec %}
| [View and install packages](/packages/publishing-and-managing-packages) | **X** | **X** | **X** | **X** | **X** |
| [Publish packages](/packages/publishing-and-managing-packages/publishing-a-package) | | | **X** | **X** | **X** |
| {% ifversion fpt or ghes > 3.0 or ghec %}[Delete and restore packages](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 or ghae %}[Delete packages](/packages/learn-github-packages/deleting-a-package){% endif %} | | | | | **X** | {% endif %}
| {% ifversion fpt or ghes > 3.0 or ghec or ghae %}[Delete and restore packages](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 %}[Delete packages](/packages/learn-github-packages/deleting-a-package){% endif %} | | | | | **X** | {% endif %}
| Manage [topics](/articles/classifying-your-repository-with-topics) | | | | **X** | **X** |
| Enable wikis and restrict wiki editors | | | | **X** | **X** |
| Enable project boards | | | | **X** | **X** |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ To use or manage a package hosted by a package registry, you must use a token wi

For example:
- To download and install packages from a repository, your token must have the `read:packages` scope, and your user account must have read permission.
- {% ifversion fpt or ghes > 3.0 or ghec %}To delete a package on {% data variables.product.product_name %}, your token must at least have the `delete:packages` and `read:packages` scope. The `repo` scope is also required for repo-scoped packages.{% elsif ghes < 3.1 %}To delete a specified version of a private package on {% data variables.product.product_name %}, your token must have the `delete:packages` and `repo` scope. Public packages cannot be deleted.{% elsif ghae %}To delete a specified version of a package on {% data variables.product.product_name %}, your token must have the `delete:packages` and `repo` scope.{% endif %} For more information, see "{% ifversion fpt or ghes > 3.0 or ghec %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 or ghae %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}."
- {% ifversion fpt or ghes > 3.0 or ghec %}To delete a package on {% data variables.product.product_name %}, your token must at least have the `delete:packages` and `read:packages` scope. The `repo` scope is also required for repo-scoped packages.{% elsif ghes < 3.1 %}To delete a specified version of a private package on {% data variables.product.product_name %}, your token must have the `delete:packages` and `repo` scope. Public packages cannot be deleted.{% elsif ghae %}To delete a specified version of a package on {% data variables.product.product_name %}, your token must have the `delete:packages` and `repo` scope.{% endif %} For more information, see "{% ifversion fpt or ghes > 3.0 or ghec or ghae %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}."

| Scope | Description | Required permission |
| --- | --- | --- |
Expand Down
3 changes: 1 addition & 2 deletions content/packages/learn-github-packages/deleting-a-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ intro: 'You can delete a version of a {% ifversion not ghae %}private{% endif %}
product: '{% data reusables.gated-features.packages %}'
versions:
ghes: '>=2.22 <3.1'
ghae: '*'
---

{% data reusables.package_registry.packages-ghes-release-stage %}
Expand All @@ -31,7 +30,7 @@ To delete a {% ifversion not ghae %}private {% endif %}package version, you must

## Deleting a version of a {% ifversion not ghae %}private {% endif %}package with GraphQL

Use the `deletePackageVersion` mutation in the GraphQL API. You must use a token with the `read:packages`, `delete:packages`, and `repo` scopes. For more information about tokens, see "[About {% data variables.product.prodname_registry %}](/packages/publishing-and-managing-packages/about-github-packages#authenticating-to-github-packages)."
Use the `deletePackageVersion` mutation in the GraphQL API. You must use a token with the `read:packages`, `delete:packages`, and `repo` scopes. For more information about tokens, see "[About {% data variables.product.prodname_registry %}](/packages/publishing-and-managing-packages/about-github-packages#authenticating-to-github-packages)."

Here is an example cURL command to delete a package version with the package version ID of `MDIyOlJlZ2lzdHJ5UGFja2FnZVZlcnNpb243MTExNg`, using a personal access token.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ versions:
fpt: '*'
ghes: '>=3.1'
ghec: '*'
ghae: '*'
shortTitle: Delete & restore a package
---

Expand All @@ -36,6 +37,7 @@ On {% data variables.product.prodname_dotcom %}, you can also restore an entire
- You restore the package within 30 days of its deletion.
- The same package namespace is still available and not used for a new package.

{% ifversion fpt or ghec or ghes %}
## Packages API support

{% ifversion fpt or ghec %}
Expand All @@ -44,7 +46,7 @@ You can use the REST API to manage your packages. For more information, see the

{% endif %}

For packages that inherit their permissions and access from repositories, you can use GraphQL to delete a specific package version.{% ifversion fpt or ghec %} The {% data variables.product.prodname_registry %} GraphQL API does not support containers or Docker images that use the package namespace `https://ghcr.io/OWNER/PACKAGE-NAME`. For more information about GraphQL support, see "[Deleting a version of a repository-scoped package with GraphQL](#deleting-a-version-of-a-repository-scoped-package-with-graphql)."
For packages that inherit their permissions and access from repositories, you can use GraphQL to delete a specific package version.{% ifversion fpt or ghec %} The {% data variables.product.prodname_registry %} GraphQL API does not support containers or Docker images that use the package namespace `https://ghcr.io/OWNER/PACKAGE-NAME`.{% endif %} For more information about GraphQL support, see "[Deleting a version of a repository-scoped package with GraphQL](#deleting-a-version-of-a-repository-scoped-package-with-graphql)."

{% endif %}

Expand All @@ -63,7 +65,7 @@ Repository-scoped packages on {% data variables.product.prodname_registry %} inc
{% ifversion fpt or ghec %}

To delete a package that has granular permissions separate from a repository, such as container images stored at `https://ghcr.io/OWNER/PACKAGE-NAME`, you must have admin access to the package.
<!--PLACEHOLDER - once packages restructuring is done this is a good place to link to the access control and visibility article.-->
For more information, see "[About permissions for {% data variables.product.prodname_registry %}](/packages/learn-github-packages/about-permissions-for-github-packages)."

{% endif %}

Expand All @@ -82,14 +84,14 @@ To delete a version of a repository-scoped package, you must have admin permissi
6. To confirm deletion, type the package name and click **I understand the consequences, delete this version**.
![Confirm package deletion button](/assets/images/help/package-registry/package-version-deletion-confirmation.png)

{% ifversion fpt or ghec or ghes %}
### Deleting a version of a repository-scoped package with GraphQL

For packages that inherit their permissions and access from repositories, you can use the GraphQL to delete a specific package version.

{% ifversion fpt or ghec %}
GraphQL is not supported for containers or Docker images at `ghcr.io`.
For containers or Docker images at `ghcr.io`, GraphQL is not supported but you can use the REST API. For more information, see the "[{% data variables.product.prodname_registry %} API](/rest/reference/packages)."
{% endif %}
<!--PLACEHOLDER for when API link is live: For full support, use the REST API. For more information, see the "[{% data variables.product.prodname_registry %} API](/rest/reference/packages)." -->

Use the `deletePackageVersion` mutation in the GraphQL API. You must use a token with the `read:packages`, `delete:packages`, and `repo` scopes. For more information about tokens, see "[About {% data variables.product.prodname_registry %}](/packages/publishing-and-managing-packages/about-github-packages#authenticating-to-github-packages)."

Expand All @@ -109,6 +111,8 @@ For more information about the `deletePackageVersion` mutation, see "[`deletePac

You cannot directly delete an entire package using GraphQL, but if you delete every version of a package, the package will no longer show on {% data variables.product.product_name %}.

{% endif %}

{% ifversion fpt or ghec %}
### Deleting a version of a user-scoped package on {% data variables.product.prodname_dotcom %}

Expand All @@ -124,12 +128,12 @@ To review who can delete a package version, see "[Required permissions](#require
6. To confirm deletion, type the package name and click **I understand the consequences, delete this version**.
![Confirm package deletion button](/assets/images/help/package-registry/confirm-container-package-version-deletion.png)

### Deleting a version of an organization-scoped package on GitHub
### Deleting a version of an organization-scoped package on {% data variables.product.prodname_dotcom %}

To delete a specific version of an organization-scoped package on {% data variables.product.prodname_dotcom %}, such as for a Docker image at `ghcr.io`, use these steps.
To delete an entire package, see "[Deleting an entire organization-scoped package on {% data variables.product.prodname_dotcom %}](#deleting-an-entire-organization-scoped-package-on-github)."

To review who can delete a package version, see "[Required permissions](#required-permissions-to-delete-or-restore-a-package)."
To review who can delete a package version, see "[Required permissions to delete or restore a package](#required-permissions-to-delete-or-restore-a-package)."

{% data reusables.package_registry.package-settings-from-org-level %}
{% data reusables.package_registry.package-settings-option %}
Expand Down Expand Up @@ -189,18 +193,24 @@ You can restore a deleted package or version if:

For example, if you have a deleted rubygem package named `octo-package` that was scoped to the repo `octo-repo-owner/octo-repo`, then you can only restore the package if the package namespace `rubygem.pkg.github.com/octo-repo-owner/octo-repo/octo-package` is still available, and 30 days have not yet passed.

You must also meet one of these permission requirements:
{% ifversion fpt or ghec %}
To restore a deleted package, you must also meet one of these permission requirements:
- For repository-scoped packages: You have admin permissions to the repository that owns the deleted package.{% ifversion fpt or ghec %}
- For user-account scoped packages: Your user account owns the deleted package.
- For organization-scoped packages: You have admin permissions to the deleted package in the organization that owns the package.{% endif %}
{% endif %}

{% ifversion ghae or ghes %}
To delete a package, you must also have admin permissions to the repository that owns the deleted package.
{% endif %}

For more information, see "[Required permissions](#required-permissions-to-delete-or-restore-a-package)."

Once the package is restored, the package will use the same namespace it did before. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.

### Restoring a package in an organization

You can restore a deleted package through your organization account settings, as long as the package was in one of your repositories{% ifversion fpt or ghec %} or had granular permissions and was scoped to your organization account{% endif %}.
You can restore a deleted package through your organization account settings, as long as the package was in a repository owned by the organizaton{% ifversion fpt or ghec %} or had granular permissions and was scoped to your organization account{% endif %}.

To review who can restore a package in an organization, see "[Required permissions](#required-permissions-to-delete-or-restore-a-package)."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ You can delete a version of a private package in the {% data variables.product.p
You can delete a version of a package in the {% data variables.product.product_name %} user interface or using the GraphQL API.
{% endif %}

When you use the GraphQL API to query and delete private packages, you must use the same token you use to authenticate to {% data variables.product.prodname_registry %}. For more information, see "{% ifversion fpt or ghes > 3.0 or ghec %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 or ghae %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}" and "[Forming calls with GraphQL]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/forming-calls-with-graphql)."
When you use the GraphQL API to query and delete private packages, you must use the same token you use to authenticate to {% data variables.product.prodname_registry %}. For more information, see "{% ifversion fpt or ghes > 3.0 or ghec or ghae %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}" and "[Forming calls with GraphQL]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/forming-calls-with-graphql)."

You can configure webhooks to subscribe to package-related events, such as when a package is published or updated. For more information, see the "[`package` webhook event](/webhooks/event-payloads/#package)."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,4 @@ To install an Apache Maven package from {% data variables.product.prodname_regis
## Further reading

- "[Working with the Gradle registry](/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry)"
- "{% ifversion fpt or ghes > 3.0 or ghec %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 or ghae %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}"
- "{% ifversion fpt or ghes > 3.0 or ghec or ghae %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}"
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,6 @@ $ docker pull <em>HOSTNAME/OWNER/REPOSITORY/IMAGE_NAME:TAG_NAME</em>

## Further reading

- "{% ifversion fpt or ghes > 3.0 or ghec %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 or ghae %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}"
- "{% ifversion fpt or ghes > 3.0 or ghec or ghae %}[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package){% elsif ghes < 3.1 %}[Deleting a package](/packages/learn-github-packages/deleting-a-package){% endif %}"

{% endif %} <!-- End of main versioning block -->
Loading

0 comments on commit d3f1cf8

Please sign in to comment.