Skip to content

Commit fbc3a9f

Browse files
committed
v1.0.0
0 parents  commit fbc3a9f

File tree

7 files changed

+198
-0
lines changed

7 files changed

+198
-0
lines changed

.github/workflows/ncm-report.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: NodeSource Certification process
2+
on: [push, pull_request]
3+
4+
jobs:
5+
ncm_report:
6+
runs-on: ubuntu-latest
7+
name: NodeSource Certification process
8+
steps:
9+
- uses: actions/checkout@v2
10+
- run: npm install
11+
- name: Report without options
12+
id: report
13+
uses: nodesource/ncm-report-github-action@master
14+
with:
15+
token: ${{ secrets.NCM_TOKEN }}
16+
- name: Report with --long
17+
id: report_long
18+
uses: nodesource/ncm-report-github-action@master
19+
with:
20+
token: ${{ secrets.NCM_TOKEN }}
21+
long: 'yes'
22+
- name: Report with --compliance
23+
id: report_compliance
24+
uses: nodesource/ncm-report-github-action@master
25+
with:
26+
token: ${{ secrets.NCM_TOKEN }}
27+
compliance: 'yes'
28+
- name: Report with --security
29+
id: report_security
30+
uses: nodesource/ncm-report-github-action@master
31+
with:
32+
token: ${{ secrets.NCM_TOKEN }}
33+
security: 'yes'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
node_modules/

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node:12
2+
3+
LABEL version="1.0.0"
4+
LABEL repository="https://github.com/nodesource/ncm-github-action"
5+
LABEL homepage="https://nodesource.com"
6+
LABEL maintainer="NodeSource"
7+
8+
RUN apt-get update && apt-get install -y g++ build-essential
9+
RUN npm install -g ncm-cli
10+
11+
COPY entrypoint.sh /entrypoint.sh
12+
13+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# NCM Report Github Action
2+
3+
![NodeSource Certification process](https://github.com/nodesource/ncm-report-github-action/workflows/NodeSource%20Certification%20process/badge.svg?event=push)
4+
5+
This action generates and prints a project-wide report of directory risk and
6+
quality of installed or specified packages.
7+
8+
## Inputs
9+
10+
### `token`
11+
12+
_Default_: `<empty>`
13+
14+
**Required** Learn more about obtaining NodeSource service tokens and
15+
configuring permissions [here](https://docs.nodesource.com/ncm_v2/docs#ci-setup).
16+
We recommend you using repository [Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) to store this value and use it in the workflow.
17+
18+
### `long`
19+
20+
_Default_: `no`
21+
22+
**Optional** Set `yes` if you want the report display a list of all modules.
23+
24+
### `compliance`
25+
26+
_Default_: `no`
27+
28+
**Optional** Set `yes` if you want the report only display non-compliant
29+
packages.
30+
31+
### `security`
32+
33+
_Default_: `no`
34+
35+
**Optional** Set `yes` if you want the report only display packages with
36+
vulnerabilities.
37+
38+
## Example usage
39+
40+
This action can be used in the following scenarios:
41+
42+
* Default report:
43+
44+
```
45+
uses: nodesource/ncm-report-github-action@master
46+
with:
47+
token: ${{ secrets.NCM_TOKEN }}
48+
```
49+
50+
* Long version of the report:
51+
52+
```
53+
uses: nodesource/ncm-report-github-action@master
54+
with:
55+
token: ${{ secrets.NCM_TOKEN }}
56+
long: 'yes'
57+
```
58+
59+
* Report with compliance only informaiton:
60+
61+
```
62+
uses: nodesource/ncm-report-github-action@master
63+
with:
64+
token: ${{ secrets.NCM_TOKEN }}
65+
compliance: 'yes'
66+
```
67+
68+
* Report with package vulnerabilities only informaiton:
69+
70+
```
71+
uses: nodesource/ncm-report-github-action@master
72+
with:
73+
token: ${{ secrets.NCM_TOKEN }}
74+
compliance: 'yes'
75+
```
76+
77+
To generate the report, `NCM` needs to get your `node_modules` folder to analyze
78+
and compare data, so, you might need to use more actions to get your code inside the
79+
workflow and the dependencies installed. We recommend you using:
80+
81+
```
82+
- uses: actions/checkout@v2
83+
- run: npm install
84+
```
85+
86+
Feel free to check the workflow in `github/workflows/ncm-report.yml` for
87+
reference and real world usage example.

action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'NCM Report'
2+
description: 'Generates a project-wide report of directory risk and quality of installed or specified packages.'
3+
inputs:
4+
token:
5+
description: 'Set a NodeSource service token'
6+
required: true
7+
long:
8+
description: 'Make a report with a list of all modules'
9+
required: false
10+
default: 'no'
11+
compliance:
12+
description: 'Only display non-compliant packages'
13+
required: false
14+
default: 'no'
15+
security:
16+
description: 'Only display packages with vulnerabilities'
17+
required: false
18+
default: 'no'
19+
20+
runs:
21+
using: 'docker'
22+
image: 'Dockerfile'
23+
args:
24+
- ${{ inputs.token }}
25+
- ${{ inputs.long }}
26+
- ${{ inputs.compliance }}
27+
- ${{ inputs.security }}
28+
29+
branding:
30+
icon: 'layers'
31+
color: 'green'

entrypoint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash -l
2+
3+
if [[ "$2" = "yes" ]]
4+
then
5+
NCM_TOKEN=$1 ncm report --long
6+
elif [[ "$3" = "yes" ]]
7+
then
8+
NCM_TOKEN=$1 ncm report --compliance
9+
elif [[ "$4" = "yes" ]]
10+
then
11+
NCM_TOKEN=$1 ncm report --security
12+
else
13+
NCM_TOKEN=$1 ncm report
14+
fi

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "test-file-for-workflows",
3+
"version": "1.0.0",
4+
"description": "The easiest way to test NCM Report feature",
5+
"scripts": {
6+
"lint": "standard"
7+
},
8+
"keywords": [],
9+
"author": "NodeSource",
10+
"license": "MIT",
11+
"devDependencies": {
12+
"is-wsl": "^2.1.1",
13+
"open": "^7.0.0"
14+
},
15+
"dependencies": {
16+
"colorette": "^1.1.0"
17+
}
18+
}

0 commit comments

Comments
 (0)