try to fix npm run pack?
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
import {deletePackageVersion, deletePackageVersions} from '../../src/version'
|
|
||||||
|
|
||||||
const githubToken = process.env.GITHUB_TOKEN as string
|
|
||||||
|
|
||||||
describe.skip('delete tests', () => {
|
|
||||||
it('deletePackageVersion', async () => {
|
|
||||||
const response = await deletePackageVersion(
|
|
||||||
'PV_lADOGReZt84AEI7FzgDSHEI',
|
|
||||||
githubToken
|
|
||||||
).toPromise()
|
|
||||||
expect(response).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('deletePackageVersions', async () => {
|
|
||||||
const response = await deletePackageVersions(
|
|
||||||
[
|
|
||||||
'PV_lADOGReZt84AEI7FzgDSHDs',
|
|
||||||
'PV_lADOGReZt84AEI7FzgDSHDY',
|
|
||||||
'PV_lADOGReZt84AEI7FzgDSHC8'
|
|
||||||
],
|
|
||||||
githubToken
|
|
||||||
).toPromise()
|
|
||||||
expect(response).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
Vendored
+4500
-2206
File diff suppressed because one or more lines are too long
+11
-1
@@ -146,5 +146,15 @@ export function deleteVersions(input: Input): Observable<boolean> {
|
|||||||
|
|
||||||
const result = finalIds(input)
|
const result = finalIds(input)
|
||||||
|
|
||||||
return result.pipe(concatMap(ids => deletePackageVersions(ids, input.owner, input.packageName, input.packageType, input.token)))
|
return result.pipe(
|
||||||
|
concatMap(ids =>
|
||||||
|
deletePackageVersions(
|
||||||
|
ids,
|
||||||
|
input.owner,
|
||||||
|
input.packageName,
|
||||||
|
input.packageType,
|
||||||
|
input.token
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import {deleteVersions} from './delete'
|
|||||||
import {catchError} from 'rxjs/operators'
|
import {catchError} from 'rxjs/operators'
|
||||||
|
|
||||||
function getActionInput(): Input {
|
function getActionInput(): Input {
|
||||||
console.log("this is deletion using rest APIs")
|
console.log('this is deletion using rest APIs')
|
||||||
return new Input({
|
return new Input({
|
||||||
packageVersionIds: getInput('package-version-ids')
|
packageVersionIds: getInput('package-version-ids')
|
||||||
? getInput('package-version-ids').split(',')
|
? getInput('package-version-ids').split(',')
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import {Octokit} from '@octokit/rest'
|
|
||||||
|
|
||||||
// Centralize all Octokit references by re-exporting
|
// Centralize all Octokit references by re-exporting
|
||||||
export {Octokit} from '@octokit/rest'
|
export {Octokit} from '@octokit/rest'
|
||||||
|
|
||||||
export type OctokitOptions = {
|
export interface OctokitOptions {
|
||||||
baseUrl?: string
|
baseUrl?: string
|
||||||
userAgent?: string
|
userAgent?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getOctokit(authToken: string, opts: OctokitOptions) {
|
export function getOctokit(
|
||||||
const options: Octokit.Options = {
|
authToken: string,
|
||||||
baseUrl: "https://api.github.com"
|
opts: OctokitOptions
|
||||||
|
): github.GitHub {
|
||||||
|
const options: OctokitOptions = {
|
||||||
|
baseUrl: 'https://api.github.com'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.userAgent) {
|
if (opts.userAgent) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
import {from, Observable, merge, throwError, of} from 'rxjs'
|
import {from, Observable, merge, throwError, of} from 'rxjs'
|
||||||
import {catchError, map, tap} from 'rxjs/operators'
|
import {catchError, map, tap} from 'rxjs/operators'
|
||||||
import {graphql} from './graphql'
|
|
||||||
import {Octokit} from '@octokit/rest'
|
import {Octokit} from '@octokit/rest'
|
||||||
|
|
||||||
let deleted = 0
|
let deleted = 0
|
||||||
@@ -27,9 +26,9 @@ export function deletePackageVersion(
|
|||||||
token: string
|
token: string
|
||||||
): Observable<boolean> {
|
): Observable<boolean> {
|
||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
auth: token,
|
auth: token
|
||||||
});
|
})
|
||||||
let package_version_id = +packageVersionId
|
const package_version_id = +packageVersionId
|
||||||
// const response = octokit.rest.packages.deletePackageVersionForUser({
|
// const response = octokit.rest.packages.deletePackageVersionForUser({
|
||||||
// packageType,
|
// packageType,
|
||||||
// packageName,
|
// packageName,
|
||||||
@@ -64,10 +63,10 @@ export function deletePackageVersion(
|
|||||||
|
|
||||||
return from(
|
return from(
|
||||||
octokit.rest.packages.deletePackageVersionForUser({
|
octokit.rest.packages.deletePackageVersionForUser({
|
||||||
package_type: "npm",
|
package_type: 'npm',
|
||||||
package_name: packageName,
|
package_name: packageName,
|
||||||
username: owner,
|
username: owner,
|
||||||
package_version_id: package_version_id,
|
package_version_id
|
||||||
})
|
})
|
||||||
).pipe(
|
).pipe(
|
||||||
catchError(err => {
|
catchError(err => {
|
||||||
@@ -80,8 +79,6 @@ export function deletePackageVersion(
|
|||||||
}),
|
}),
|
||||||
map(response => response.status === 204)
|
map(response => response.status === 204)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deletePackageVersions(
|
export function deletePackageVersions(
|
||||||
|
|||||||
Reference in New Issue
Block a user