Update bundle
Some checks failed
Check Transpiled JavaScript / Check dist/ (push) Successful in 34s
build-test / build (20, ubuntu-latest) (push) Failing after 22s
build-test / test (20, ubuntu-latest) (push) Failing after 13s
build-test / build (20, macos-latest) (push) Has been cancelled
build-test / build-on-windows (20) (push) Has been cancelled
build-test / test (20, macos-latest) (push) Has been cancelled
git tag major version / tag-major-version (release) Failing after 9s
daily scan / npm audit (macos-latest) (push) Waiting to run
daily scan / npm audit (ubuntu-latest) (push) Failing after 37s
Some checks failed
Check Transpiled JavaScript / Check dist/ (push) Successful in 34s
build-test / build (20, ubuntu-latest) (push) Failing after 22s
build-test / test (20, ubuntu-latest) (push) Failing after 13s
build-test / build (20, macos-latest) (push) Has been cancelled
build-test / build-on-windows (20) (push) Has been cancelled
build-test / test (20, macos-latest) (push) Has been cancelled
git tag major version / tag-major-version (release) Failing after 9s
daily scan / npm audit (macos-latest) (push) Waiting to run
daily scan / npm audit (ubuntu-latest) (push) Failing after 37s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[!INFO]
|
||||
This repo is a scuffed Gitea port of the [original](https://github.com/oke-py/npm-audit-action) project
|
||||
[!INFO] This repo is a scuffed Gitea port of the
|
||||
[original](https://github.com/oke-py/npm-audit-action) project
|
||||
|
||||
# npm audit action
|
||||
|
||||
|
||||
10428
dist/index.js
generated
vendored
10428
dist/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
25
src/issue.ts
25
src/issue.ts
@@ -2,7 +2,10 @@ import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import { Api, CreateIssueOption, HttpResponse, Issue } from 'gitea-js'
|
||||
|
||||
export async function getIssueOption(api: Api<unknown>, body: string): Promise<CreateIssueOption> {
|
||||
export async function getIssueOption(
|
||||
api: Api<unknown>,
|
||||
body: string
|
||||
): Promise<CreateIssueOption> {
|
||||
let assignees: string[] | undefined
|
||||
let labels: number[] | undefined
|
||||
|
||||
@@ -10,19 +13,23 @@ export async function getIssueOption(api: Api<unknown>, body: string): Promise<C
|
||||
assignees = core.getInput('issue_assignees').replace(/\s+/g, '').split(',')
|
||||
}
|
||||
if (core.getInput('issue_labels')) {
|
||||
labels = [];
|
||||
labels = []
|
||||
const labelNames = core
|
||||
.getInput('issue_labels')
|
||||
.split(',')
|
||||
.map((label) => label.trim());
|
||||
(await api.repos.issueListLabels(github.context.repo.owner, github.context.repo.repo)).data.forEach(label => {
|
||||
.map((label) => label.trim())
|
||||
;(
|
||||
await api.repos.issueListLabels(
|
||||
github.context.repo.owner,
|
||||
github.context.repo.repo
|
||||
)
|
||||
).data.forEach((label) => {
|
||||
if (label.name && label.id && labelNames.includes(label.name)) {
|
||||
labels?.push(label.id);
|
||||
labels?.push(label.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
title: core.getInput('issue_title'),
|
||||
body,
|
||||
@@ -38,10 +45,10 @@ export async function getExistingIssueNumber(
|
||||
repo: string
|
||||
}
|
||||
): Promise<number | null> {
|
||||
issues.data.forEach(iss => {
|
||||
issues.data.forEach((iss) => {
|
||||
if (iss.title == core.getInput('issue_title')) {
|
||||
return iss.number;
|
||||
return iss.number
|
||||
}
|
||||
})
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
|
||||
26
src/main.ts
26
src/main.ts
@@ -68,7 +68,7 @@ export async function run(): Promise<void> {
|
||||
if (audit.foundVulnerability()) {
|
||||
// vulnerabilities are found
|
||||
|
||||
core.debug(github.context.apiUrl);
|
||||
core.debug(github.context.apiUrl)
|
||||
|
||||
// get GitHub information
|
||||
const ctx = JSON.parse(core.getInput('gitea_context'))
|
||||
@@ -108,21 +108,37 @@ export async function run(): Promise<void> {
|
||||
|
||||
// remove control characters and create a code block
|
||||
const issueBody = audit.strippedStdout()
|
||||
const option: CreateIssueOption = await issue.getIssueOption(api, issueBody)
|
||||
const option: CreateIssueOption = await issue.getIssueOption(
|
||||
api,
|
||||
issueBody
|
||||
)
|
||||
|
||||
const existingIssueNumber =
|
||||
core.getInput('dedupe_issues') === 'true'
|
||||
? await issue.getExistingIssueNumber(
|
||||
await api.repos.issueListIssues(github.context.repo.owner, github.context.repo.repo, {state: "all"}),
|
||||
await api.repos.issueListIssues(
|
||||
github.context.repo.owner,
|
||||
github.context.repo.repo,
|
||||
{ state: 'all' }
|
||||
),
|
||||
github.context.repo
|
||||
)
|
||||
: null
|
||||
|
||||
if (existingIssueNumber !== null) {
|
||||
const { data: createdComment } = await api.repos.issueCreateComment(github.context.repo.owner, github.context.repo.repo, existingIssueNumber, {body: option.body ?? ""})
|
||||
const { data: createdComment } = await api.repos.issueCreateComment(
|
||||
github.context.repo.owner,
|
||||
github.context.repo.repo,
|
||||
existingIssueNumber,
|
||||
{ body: option.body ?? '' }
|
||||
)
|
||||
core.debug(`comment ${createdComment.issue_url}`)
|
||||
} else {
|
||||
const { data: createdIssue } = await api.repos.issueCreateIssue(github.context.repo.owner, github.context.repo.repo, option)
|
||||
const { data: createdIssue } = await api.repos.issueCreateIssue(
|
||||
github.context.repo.owner,
|
||||
github.context.repo.repo,
|
||||
option
|
||||
)
|
||||
core.debug(`#${createdIssue.number}`)
|
||||
}
|
||||
core.setFailed('This repo has some vulnerabilities')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Api } from "gitea-js";
|
||||
import { Api } from 'gitea-js'
|
||||
|
||||
export async function createComment(
|
||||
api: Api<unknown>,
|
||||
@@ -9,5 +9,5 @@ export async function createComment(
|
||||
): Promise<void> {
|
||||
await api.repos.issueCreateComment(owner, repo, prNumber, {
|
||||
body
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user