Merge branch 'improve-existing-action' of https://github.com/actions/delete-package-versions into improve-existing-action
This commit is contained in:
@@ -78,7 +78,7 @@ export function finalIds(input: Input): Observable<string[]> {
|
||||
input.owner,
|
||||
input.repo,
|
||||
input.packageName,
|
||||
RATE_LIMIT,
|
||||
100,
|
||||
'',
|
||||
input.token
|
||||
).pipe(
|
||||
@@ -99,6 +99,11 @@ export function finalIds(input: Input): Observable<string[]> {
|
||||
}
|
||||
return value.map(info => info.id).slice(0, toDelete)
|
||||
} else return []
|
||||
/*
|
||||
if (toDelete > 0) {
|
||||
input.numDeleted += toDelete
|
||||
return value.map(info => info.id).slice(0, toDelete)
|
||||
} else return []*/
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,39 @@ const mutation = `
|
||||
}
|
||||
}`
|
||||
|
||||
export interface RateLimitResponse {
|
||||
viewer: {
|
||||
login: string
|
||||
}
|
||||
ratelimit: {
|
||||
limit: number
|
||||
cost: number
|
||||
remaining: number
|
||||
resetAt: string
|
||||
}
|
||||
}
|
||||
|
||||
const ratelimitQuery = `
|
||||
query {
|
||||
viewer {
|
||||
login
|
||||
}
|
||||
rateLimit {
|
||||
limit
|
||||
cost
|
||||
remaining
|
||||
resetAt
|
||||
}
|
||||
}`
|
||||
|
||||
export async function getRateLimit(token: string): Promise<RateLimitResponse> {
|
||||
return graphql(token, ratelimitQuery, {
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.package-deletes-preview+json'
|
||||
}
|
||||
}) as Promise<RateLimitResponse>
|
||||
}
|
||||
|
||||
export function deletePackageVersion(
|
||||
packageVersionId: string,
|
||||
token: string
|
||||
|
||||
Reference in New Issue
Block a user