Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Gioyik committed Apr 26, 2020
1 parent fbc3a9f commit b10a727
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 48 deletions.
30 changes: 7 additions & 23 deletions .github/workflows/ncm-report.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
name: NodeSource Certification process
on: [push, pull_request]
name: NodeSource Certification
on: pull_request

jobs:
ncm_report:
runs-on: ubuntu-latest
name: NodeSource Certification process
name: N|S -> NCM Pipeline
steps:
- uses: actions/checkout@v2
- run: npm install
- name: Report without options
- name: NCM Report
id: report
uses: nodesource/ncm-report-github-action@master
uses: nodesource/ncm-report-github-action@v1.1.0
with:
token: ${{ secrets.NCM_TOKEN }}
- name: Report with --long
id: report_long
uses: nodesource/ncm-report-github-action@master
with:
token: ${{ secrets.NCM_TOKEN }}
long: 'yes'
- name: Report with --compliance
id: report_compliance
uses: nodesource/ncm-report-github-action@master
with:
token: ${{ secrets.NCM_TOKEN }}
compliance: 'yes'
- name: Report with --security
id: report_security
uses: nodesource/ncm-report-github-action@master
with:
token: ${{ secrets.NCM_TOKEN }}
security: 'yes'
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job_name: N|S -> NCM Pipeline
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL homepage="https://nodesource.com"
LABEL maintainer="NodeSource"

RUN apt-get update && apt-get install -y g++ build-essential
RUN npm install -g ncm-cli
RUN npm install -g nodesource/ncm-cli#gio/bump

COPY entrypoint.sh /entrypoint.sh

Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ _Default_: `no`
**Optional** Set `yes` if you want the report only display packages with
vulnerabilities.

### `github_token`

_Default_: `${{ secrets.GITHUB_TOKEN }}`

**Required** Set to pass the internal GitHub Token for NCM to update the check
and make annotations. Use the default value (`${{ secrets.GITHUB_TOKEN }}`), you
don't need to create any token in Secrets for this, GitHub automatically creates
and sets this in the Action context.

### `github_job_name`

_Default_: `<empty>`

**Required** You need to set the same name you set to your job. If not,
annotations will not be able to be included in your PR or RunCheck.

## Example usage

This action can be used in the following scenarios:
Expand All @@ -45,6 +61,8 @@ This action can be used in the following scenarios:
uses: nodesource/ncm-report-github-action@master
with:
token: ${{ secrets.NCM_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job_name: N|S -> NCM Pipeline
```

* Long version of the report:
Expand All @@ -54,6 +72,8 @@ uses: nodesource/ncm-report-github-action@master
with:
token: ${{ secrets.NCM_TOKEN }}
long: 'yes'
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job_name: N|S -> NCM Pipeline
```

* Report with compliance only informaiton:
Expand All @@ -63,6 +83,8 @@ uses: nodesource/ncm-report-github-action@master
with:
token: ${{ secrets.NCM_TOKEN }}
compliance: 'yes'
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job_name: N|S -> NCM Pipeline
```

* Report with package vulnerabilities only informaiton:
Expand All @@ -72,11 +94,13 @@ uses: nodesource/ncm-report-github-action@master
with:
token: ${{ secrets.NCM_TOKEN }}
compliance: 'yes'
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job_name: N|S -> NCM Pipeline
```

To generate the report, `NCM` needs to get your `node_modules` folder to analyze
and compare data, so, you might need to use more actions to get your code inside the
workflow and the dependencies installed. We recommend you using:
and compare data, so, you might need to use more actions to get your code inside
the workflow and the dependencies installed. We recommend you using:

```
- uses: actions/checkout@v2
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ inputs:
description: 'Only display packages with vulnerabilities'
required: false
default: 'no'
github_token:
description: 'Send a Github Token'
required: true
default: ''
github_job_name:
description: 'Set the name of the job'
required: true

runs:
using: 'docker'
Expand All @@ -25,6 +32,8 @@ runs:
- ${{ inputs.long }}
- ${{ inputs.compliance }}
- ${{ inputs.security }}
- ${{ inputs.github_token }}
- ${{ inputs.github_job_name }}

branding:
icon: 'layers'
Expand Down
8 changes: 4 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

if [[ "$2" = "yes" ]]
then
NCM_TOKEN=$1 ncm report --long
FORCE_COLOR=2 IS_GITHUB_ACTION=true NCM_TOKEN=$1 ncm report --long
elif [[ "$3" = "yes" ]]
then
NCM_TOKEN=$1 ncm report --compliance
FORCE_COLOR=2 IS_GITHUB_ACTION=true NCM_TOKEN=$1 ncm report --compliance
elif [[ "$4" = "yes" ]]
then
NCM_TOKEN=$1 ncm report --security
FORCE_COLOR=2 IS_GITHUB_ACTION=true NCM_TOKEN=$1 ncm report --security
else
NCM_TOKEN=$1 ncm report
FORCE_COLOR=2 IS_GITHUB_ACTION=true NCM_TOKEN=$1 ncm report
fi
18 changes: 0 additions & 18 deletions package.json

This file was deleted.

0 comments on commit b10a727

Please sign in to comment.