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

This commit is contained in:
Dark Steveneq
2026-01-20 09:54:53 +01:00
parent dcb52e1b7d
commit d0cc7b6646
6 changed files with 6678 additions and 3815 deletions

View File

@@ -1,5 +1,5 @@
[!INFO] [!INFO] This repo is a scuffed Gitea port of the
This repo is a scuffed Gitea port of the [original](https://github.com/oke-py/npm-audit-action) project [original](https://github.com/oke-py/npm-audit-action) project
# npm audit action # npm audit action

10428
dist/index.js generated vendored

File diff suppressed because it is too large Load Diff

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,10 @@ import * as core from '@actions/core'
import * as github from '@actions/github' import * as github from '@actions/github'
import { Api, CreateIssueOption, HttpResponse, Issue } from 'gitea-js' 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 assignees: string[] | undefined
let labels: number[] | 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(',') assignees = core.getInput('issue_assignees').replace(/\s+/g, '').split(',')
} }
if (core.getInput('issue_labels')) { if (core.getInput('issue_labels')) {
labels = []; labels = []
const labelNames = core const labelNames = core
.getInput('issue_labels') .getInput('issue_labels')
.split(',') .split(',')
.map((label) => label.trim()); .map((label) => label.trim())
(await api.repos.issueListLabels(github.context.repo.owner, github.context.repo.repo)).data.forEach(label => { ;(
await api.repos.issueListLabels(
github.context.repo.owner,
github.context.repo.repo
)
).data.forEach((label) => {
if (label.name && label.id && labelNames.includes(label.name)) { if (label.name && label.id && labelNames.includes(label.name)) {
labels?.push(label.id); labels?.push(label.id)
} }
}) })
} }
return { return {
title: core.getInput('issue_title'), title: core.getInput('issue_title'),
body, body,
@@ -38,10 +45,10 @@ export async function getExistingIssueNumber(
repo: string repo: string
} }
): Promise<number | null> { ): Promise<number | null> {
issues.data.forEach(iss => { issues.data.forEach((iss) => {
if (iss.title == core.getInput('issue_title')) { if (iss.title == core.getInput('issue_title')) {
return iss.number; return iss.number
} }
}) })
return null; return null
} }

View File

@@ -68,7 +68,7 @@ export async function run(): Promise<void> {
if (audit.foundVulnerability()) { if (audit.foundVulnerability()) {
// vulnerabilities are found // vulnerabilities are found
core.debug(github.context.apiUrl); core.debug(github.context.apiUrl)
// get GitHub information // get GitHub information
const ctx = JSON.parse(core.getInput('gitea_context')) 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 // remove control characters and create a code block
const issueBody = audit.strippedStdout() const issueBody = audit.strippedStdout()
const option: CreateIssueOption = await issue.getIssueOption(api, issueBody) const option: CreateIssueOption = await issue.getIssueOption(
api,
issueBody
)
const existingIssueNumber = const existingIssueNumber =
core.getInput('dedupe_issues') === 'true' core.getInput('dedupe_issues') === 'true'
? await issue.getExistingIssueNumber( ? 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 github.context.repo
) )
: null : null
if (existingIssueNumber !== 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}`) core.debug(`comment ${createdComment.issue_url}`)
} else { } 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.debug(`#${createdIssue.number}`)
} }
core.setFailed('This repo has some vulnerabilities') core.setFailed('This repo has some vulnerabilities')

View File

@@ -1,4 +1,4 @@
import { Api } from "gitea-js"; import { Api } from 'gitea-js'
export async function createComment( export async function createComment(
api: Api<unknown>, api: Api<unknown>,
@@ -9,5 +9,5 @@ export async function createComment(
): Promise<void> { ): Promise<void> {
await api.repos.issueCreateComment(owner, repo, prNumber, { await api.repos.issueCreateComment(owner, repo, prNumber, {
body body
}); })
} }