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)
|
||||
})
|
||||
})
|
||||
6706
dist/index.js
vendored
6706
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -146,5 +146,15 @@ export function deleteVersions(input: Input): Observable<boolean> {
|
||||
|
||||
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
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {deleteVersions} from './delete'
|
||||
import {catchError} from 'rxjs/operators'
|
||||
|
||||
function getActionInput(): Input {
|
||||
console.log("this is deletion using rest APIs")
|
||||
console.log('this is deletion using rest APIs')
|
||||
return new Input({
|
||||
packageVersionIds: getInput('package-version-ids')
|
||||
? getInput('package-version-ids').split(',')
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
import * as github from '@actions/github'
|
||||
import {Octokit} from '@octokit/rest'
|
||||
|
||||
// Centralize all Octokit references by re-exporting
|
||||
export {Octokit} from '@octokit/rest'
|
||||
|
||||
export type OctokitOptions = {
|
||||
export interface OctokitOptions {
|
||||
baseUrl?: string
|
||||
userAgent?: string
|
||||
}
|
||||
|
||||
export function getOctokit(authToken: string, opts: OctokitOptions) {
|
||||
const options: Octokit.Options = {
|
||||
baseUrl: "https://api.github.com"
|
||||
export function getOctokit(
|
||||
authToken: string,
|
||||
opts: OctokitOptions
|
||||
): github.GitHub {
|
||||
const options: OctokitOptions = {
|
||||
baseUrl: 'https://api.github.com'
|
||||
}
|
||||
|
||||
if (opts.userAgent) {
|
||||
@@ -19,4 +21,4 @@ export function getOctokit(authToken: string, opts: OctokitOptions) {
|
||||
}
|
||||
|
||||
return new github.GitHub(authToken, options)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// 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'
|
||||
import {Octokit} from '@octokit/rest'
|
||||
|
||||
let deleted = 0
|
||||
@@ -27,9 +26,9 @@ export function deletePackageVersion(
|
||||
token: string
|
||||
): Observable<boolean> {
|
||||
const octokit = new Octokit({
|
||||
auth: token,
|
||||
});
|
||||
let package_version_id = +packageVersionId
|
||||
auth: token
|
||||
})
|
||||
const package_version_id = +packageVersionId
|
||||
// const response = octokit.rest.packages.deletePackageVersionForUser({
|
||||
// packageType,
|
||||
// packageName,
|
||||
@@ -64,10 +63,10 @@ export function deletePackageVersion(
|
||||
|
||||
return from(
|
||||
octokit.rest.packages.deletePackageVersionForUser({
|
||||
package_type: "npm",
|
||||
package_type: 'npm',
|
||||
package_name: packageName,
|
||||
username: owner,
|
||||
package_version_id: package_version_id,
|
||||
package_version_id
|
||||
})
|
||||
).pipe(
|
||||
catchError(err => {
|
||||
@@ -80,8 +79,6 @@ export function deletePackageVersion(
|
||||
}),
|
||||
map(response => response.status === 204)
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
export function deletePackageVersions(
|
||||
|
||||
Reference in New Issue
Block a user