Creates an issue even if inputs.issue_labels is not given (#21)
* Creates an issue even if inputs.issue_labels is not given * 1.0.0 * Use v1.0.0 in example, daily scan
This commit is contained in:
2
.github/workflows/daily.yml
vendored
2
.github/workflows/daily.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install dependencies
|
||||
run: npm ci
|
||||
- uses: oke-py/npm-audit-action@v0.1.0
|
||||
- uses: oke-py/npm-audit-action@v1.0.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue_assignees: oke-py
|
||||
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install dependencies
|
||||
run: npm ci
|
||||
- uses: oke-py/npm-audit-action@v0.1.0
|
||||
- uses: oke-py/npm-audit-action@v1.0.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue_assignees: oke-py
|
||||
|
||||
@@ -8,8 +8,8 @@ describe('getIssueOption', () => {
|
||||
const expected: IssueOption = {
|
||||
title: 'npm audit found vulnerabilities',
|
||||
body: 'hi',
|
||||
assignees: [''],
|
||||
labels: ['']
|
||||
assignees: undefined,
|
||||
labels: undefined
|
||||
}
|
||||
expect(issue.getIssueOption('hi')).toEqual(expected)
|
||||
})
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "npm-audit-action",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "npm-audit-action",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "GitHub Action to run `npm audit`",
|
||||
"main": "lib/main.js",
|
||||
|
||||
20
src/issue.ts
20
src/issue.ts
@@ -2,16 +2,20 @@ import * as core from '@actions/core'
|
||||
import {IssueOption} from './interface'
|
||||
|
||||
export function getIssueOption(body: string): IssueOption {
|
||||
let assignees
|
||||
let labels
|
||||
|
||||
if (core.getInput('issue_assignees')) {
|
||||
assignees = core.getInput('issue_assignees').replace(/\s+/g, '').split(',')
|
||||
}
|
||||
if (core.getInput('issue_labels')) {
|
||||
labels = core.getInput('issue_labels').replace(/\s+/g, '').split(',')
|
||||
}
|
||||
|
||||
return {
|
||||
title: core.getInput('issue_title'),
|
||||
body,
|
||||
assignees: core
|
||||
.getInput('issue_assignees')
|
||||
.replace(/\s+/g, '')
|
||||
.split(','),
|
||||
labels: core
|
||||
.getInput('issue_labels')
|
||||
.replace(/\s+/g, '')
|
||||
.split(',')
|
||||
assignees,
|
||||
labels
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ import * as github from '@actions/github'
|
||||
import stripAnsi from 'strip-ansi'
|
||||
import Octokit, {IssuesCreateResponse} from '@octokit/rest'
|
||||
import {Audit} from './audit'
|
||||
import * as issue from '../src/issue'
|
||||
import {IssueOption} from '../src/interface'
|
||||
import * as issue from './issue'
|
||||
import {IssueOption} from './interface'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user