Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5e64443ea | ||
|
|
9b1e76ea45 | ||
|
|
37b7aca7eb | ||
|
|
f87b4a0b81 | ||
|
|
6961202f36 | ||
|
|
4eab40be13 | ||
|
|
8701e46f41 | ||
|
|
565ec2459a | ||
|
|
ec4518c513 | ||
|
|
33300d7916 | ||
|
|
e048663cdf | ||
|
|
0e86ee6891 | ||
|
|
a31a43afa6 | ||
|
|
56849b848a | ||
|
|
000223ef3e | ||
|
|
df897cea27 | ||
|
|
b77daeff53 | ||
|
|
7515f7a4f9 | ||
|
|
3e14cd73d4 | ||
|
|
5e4787da1c | ||
|
|
355299fa7d | ||
|
|
5263253279 | ||
|
|
d6bf5f6a97 | ||
|
|
4afcc8f713 | ||
|
|
1472d90599 | ||
|
|
09f7b84634 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"plugins": ["jest", "@typescript-eslint"],
|
||||
"extends": ["plugin:github/es6"],
|
||||
"extends": ["plugin:github/recommended","plugin:@typescript-eslint/recommended"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
@@ -17,13 +17,29 @@
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/array-type": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/ban-ts-ignore": "error",
|
||||
"@typescript-eslint/ban-ts-comment": "error",
|
||||
"camelcase": "off",
|
||||
"@typescript-eslint/camelcase": "error",
|
||||
"@typescript-eslint/class-name-casing": "error",
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"error",
|
||||
{
|
||||
"selector": "class",
|
||||
"format": ["PascalCase"]
|
||||
},
|
||||
{
|
||||
"selector": "interface",
|
||||
"format": ["PascalCase"]
|
||||
},
|
||||
{
|
||||
"selector": "typeProperty",
|
||||
"format": [],
|
||||
"custom": {
|
||||
"regex": "^[A-Z][A-Za-z]*$",
|
||||
"match": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
||||
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
@@ -33,7 +49,7 @@
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||
"@typescript-eslint/no-object-literal-type-assertion": "error",
|
||||
"@typescript-eslint/consistent-type-assertions": "error",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
@@ -41,7 +57,7 @@
|
||||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"@typescript-eslint/prefer-function-type": "warn",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-interface": "error",
|
||||
"@typescript-eslint/consistent-type-definitions": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/promise-function-async": "error",
|
||||
"@typescript-eslint/require-array-sort-compare": "error",
|
||||
@@ -50,7 +66,10 @@
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "error",
|
||||
"no-console": "off"
|
||||
"no-console": "off",
|
||||
"import/no-unresolved": "off",
|
||||
"sort-imports": "off",
|
||||
"filenames/match-regex": "off"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
|
||||
4
.github/workflows/check-dist.yml
vendored
4
.github/workflows/check-dist.yml
vendored
@@ -24,10 +24,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set Node.js 12.x
|
||||
- name: Set Node.js 16.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
node-version: 16.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
2
.licenses/npm/@actions/core.dep.yml
generated
2
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@actions/core"
|
||||
version: 1.6.0
|
||||
version: 1.9.1
|
||||
type: npm
|
||||
summary: Actions core lib
|
||||
homepage: https://github.com/actions/toolkit/tree/master/packages/core
|
||||
|
||||
2
.licenses/npm/rxjs.dep.yml
generated
2
.licenses/npm/rxjs.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: rxjs
|
||||
version: 6.5.4
|
||||
version: 6.6.7
|
||||
type: npm
|
||||
summary: Reactive Extensions for modern JavaScript
|
||||
homepage: https://github.com/ReactiveX/RxJS
|
||||
|
||||
53
README.md
53
README.md
@@ -1,6 +1,8 @@
|
||||
# Delete Package Versions
|
||||
|
||||
This action deletes versions of a package from [GitHub Packages](https://github.com/features/packages) except ghcr packages. This action will only delete a maximum of 99 versions in one run.
|
||||
This action deletes versions of a package from [GitHub Packages](https://github.com/features/packages). This action will only delete a maximum of 99 versions in one run.
|
||||
|
||||
_This action does currently not support deleting packages from the GitHub Container Registry. As the npm registry is about to be migrated to the same new architecture as GHCR, this action won't work for npm soon too (see [#74](https://github.com/actions/delete-package-versions/issues/74))._
|
||||
|
||||
### What It Can Do
|
||||
|
||||
@@ -17,7 +19,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
# Usage
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
# Can be a single package version id, or a comma separated list of package version ids.
|
||||
# Defaults to an empty string.
|
||||
@@ -101,7 +103,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete all pre-release package versions except latest 10 in the same repo as the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-name: 'test-package'
|
||||
min-versions-to-keep: 10
|
||||
@@ -116,7 +118,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete all pre-release package versions except latest 10 in a different repo than the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
owner: 'github'
|
||||
repo: 'packages'
|
||||
@@ -137,9 +139,9 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete all except latest 3 package versions excluding major versions as per semver in the same repo as the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-name: 'test-packae'
|
||||
package-name: 'test-package'
|
||||
min-versions-to-keep: 3
|
||||
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
|
||||
```
|
||||
@@ -153,11 +155,11 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete all except latest 3 package versions excluding major versions as per semver in a different repo than the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
owner: 'github'
|
||||
repo: 'packages'
|
||||
package-name: 'test-packae'
|
||||
package-name: 'test-package'
|
||||
token: ${{ secrets.GITHUB_PAT }}
|
||||
min-versions-to-keep: 3
|
||||
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
|
||||
@@ -176,9 +178,9 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete 3 oldest versions excluding major versions as per semver is the same repo as the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-name: 'test-packae'
|
||||
package-name: 'test-package'
|
||||
num-old-versions-to-delete: 3
|
||||
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
|
||||
```
|
||||
@@ -191,14 +193,14 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
|
||||
__Example__
|
||||
|
||||
Delete 3 oldest versions excluding major versions as per semver is a differernt repo than the workflow
|
||||
Delete 3 oldest versions excluding major versions as per semver is a different repo than the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
owner: 'github'
|
||||
repo: 'packages'
|
||||
package-name: 'test-packae'
|
||||
package-name: 'test-package'
|
||||
token: ${{ secrets.PAT }}
|
||||
num-old-versions-to-delete: 3
|
||||
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
|
||||
@@ -215,7 +217,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete all except latest 2 versions of a package hosted in the same repo as the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-name: 'test-package'
|
||||
min-versions-to-keep: 2
|
||||
@@ -230,7 +232,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete all except latest 2 versions of a package hosted in a repo other than the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
owner: 'github'
|
||||
repo: 'packages'
|
||||
@@ -250,7 +252,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete the oldest 3 version of a package hosted in the same repo as the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-name: 'test-package'
|
||||
num-old-versions-to-delete: 3
|
||||
@@ -265,7 +267,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
Delete the oldest 3 version of a package hosted in a different repo than the one executing the workflow
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
owner: 'github'
|
||||
repo: 'packages'
|
||||
@@ -283,7 +285,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
__Example__
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-name: 'test-package'
|
||||
```
|
||||
@@ -295,7 +297,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
__Example__
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
owner: 'github'
|
||||
repo: 'packages'
|
||||
@@ -314,7 +316,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
__Example__
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3'
|
||||
```
|
||||
@@ -328,7 +330,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
__Example__
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3'
|
||||
token: ${{ secrets.PAT }}
|
||||
@@ -338,19 +340,19 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
|
||||
### Delete multiple specific versions of a package
|
||||
|
||||
To delete multiple specifc versions of a package that is hosted in the same repo as the workflow the __package-version-ids__ input is required.
|
||||
To delete multiple specific versions of a package that is hosted in the same repo as the workflow the __package-version-ids__ input is required.
|
||||
|
||||
The __package-version-ids__ input should be a comma separated string of package version ids. Package version ids can be retrieved via the [GitHub GraphQL API][api].
|
||||
|
||||
__Example__
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzQ5, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzUw'
|
||||
```
|
||||
|
||||
To delete multiple specifc versions of a package that is hosted in a repo other than the workflow the __package-version-ids__, __token__ inputs are required.
|
||||
To delete multiple specific versions of a package that is hosted in a repo other than the workflow the __package-version-ids__, __token__ inputs are required.
|
||||
|
||||
The __package-version-ids__ input should be a comma separated string of package version ids. Package version ids can be retrieved via the [GitHub GraphQL API][api].
|
||||
|
||||
@@ -359,7 +361,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
|
||||
__Example__
|
||||
|
||||
```yaml
|
||||
- uses: actions/delete-package-versions@v2
|
||||
- uses: actions/delete-package-versions@v3
|
||||
with:
|
||||
package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzQ5, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzUw'
|
||||
token: ${{ secrets.PAT }}
|
||||
@@ -372,3 +374,4 @@ The scripts and documentation in this project are released under the [MIT Licens
|
||||
[api]: https://developer.github.com/v4/previews/#github-packages
|
||||
[token]: https://help.github.com/en/packages/publishing-and-managing-packages/about-github-packages#about-tokens
|
||||
[secret]: https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ inputs:
|
||||
default: ${{ github.token }}
|
||||
|
||||
runs:
|
||||
using: node12
|
||||
using: node16
|
||||
main: dist/index.js
|
||||
|
||||
branding:
|
||||
icon: package
|
||||
color: blue
|
||||
color: blue
|
||||
|
||||
13078
dist/index.js
vendored
13078
dist/index.js
vendored
File diff suppressed because one or more lines are too long
6945
package-lock.json
generated
6945
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -25,17 +25,17 @@
|
||||
"author": "YourNameOrOrganization",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/core": "^1.9.1",
|
||||
"@actions/github": "^2.1.1",
|
||||
"rxjs": "^6.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.23",
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/node": "^12.7.12",
|
||||
"@typescript-eslint/parser": "^2.8.0",
|
||||
"@vercel/ncc": "^0.31.1",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-github": "^2.0.0",
|
||||
"eslint": "^8.9.0",
|
||||
"eslint-plugin-github": "^4.3.5",
|
||||
"eslint-plugin-jest": "^22.21.0",
|
||||
"jest": "^27.3.1",
|
||||
"jest-circus": "^27.3.1",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import {from, Observable, merge, throwError, of} from 'rxjs'
|
||||
import {catchError, map, tap} from 'rxjs/operators'
|
||||
import {graphql} from './graphql'
|
||||
@@ -11,7 +12,7 @@ export interface DeletePackageVersionMutationResponse {
|
||||
}
|
||||
|
||||
const mutation = `
|
||||
mutation deletePackageVersion($packageVersionId: String!) {
|
||||
mutation deletePackageVersion($packageVersionId: ID!) {
|
||||
deletePackageVersion(input: {packageVersionId: $packageVersionId}) {
|
||||
success
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import {GraphQlQueryResponse} from '@octokit/graphql/dist-types/types'
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import {Observable, from, throwError} from 'rxjs'
|
||||
import {catchError, map} from 'rxjs/operators'
|
||||
import {graphql} from './graphql'
|
||||
@@ -107,7 +109,7 @@ export function queryForOldestVersions(
|
||||
}
|
||||
}) as Promise<GetVersionsQueryResponse>
|
||||
).pipe(
|
||||
catchError((err: GraphQlQueryResponse) => {
|
||||
catchError((err: GraphQlQueryResponse<unknown>) => {
|
||||
const msg = 'query for oldest version failed.'
|
||||
return throwError(
|
||||
err.errors && err.errors.length > 0
|
||||
@@ -129,7 +131,7 @@ export function queryForOldestVersions(
|
||||
}
|
||||
}) as Promise<GetVersionsQueryResponse>
|
||||
).pipe(
|
||||
catchError((err: GraphQlQueryResponse) => {
|
||||
catchError((err: GraphQlQueryResponse<unknown>) => {
|
||||
const msg = 'query for oldest version failed.'
|
||||
return throwError(
|
||||
err.errors && err.errors.length > 0
|
||||
@@ -164,7 +166,7 @@ export function getOldestVersions(
|
||||
`package: ${packageName} not found for owner: ${owner} in repo: ${repo}`
|
||||
)
|
||||
r = {
|
||||
versions: <VersionInfo[]>[],
|
||||
versions: [] as VersionInfo[],
|
||||
cursor: '',
|
||||
paginate: false,
|
||||
totalCount: 0
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import {GitHub} from '@actions/github'
|
||||
import {GraphQlQueryResponseData} from '@octokit/graphql/dist-types/types'
|
||||
import {RequestParameters} from '@octokit/types/dist-types/RequestParameters'
|
||||
|
||||
Reference in New Issue
Block a user