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:
Naoki Oketani
2019-12-09 22:49:41 +09:00
committed by GitHub
parent be0cdcbe10
commit 2e5ad3c2cf
7 changed files with 20 additions and 16 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
View File

@@ -1,6 +1,6 @@
{
"name": "npm-audit-action",
"version": "0.1.0",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -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",

View File

@@ -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
}
}

View File

@@ -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 {