Skip to content

Commit

Permalink
Merge pull request #19 from dabutvin/clearlynoticed
Browse files Browse the repository at this point in the history
ClearlyNoticed
  • Loading branch information
dabutvin authored Feb 6, 2019
2 parents 775b645 + 53b9cfc commit 724409e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
workflow "NOTICE file generate" {
on = "push"
resolves = ["Chive Action"]
resolves = ["ClearlyNoticed"]
}

action "Chive Action" {
action "ClearlyNoticed" {
uses = "./"
secrets = ["GITHUB_TOKEN"]
}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:10-alpine

LABEL "com.github.actions.name"="NOTICE file generator"
LABEL "com.github.actions.description"="Generate a NOTICE file from your package-lock.json"
LABEL "com.github.actions.name"="ClearlyNoticed Action"
LABEL "com.github.actions.description"="Maintain a NOTICE file based on your package-lock.json"
LABEL "com.github.actions.icon"="droplet"
LABEL "com.github.actions.color"="green"

Expand Down
34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
# NOTICE file generator (chive-action)
# ClearlyNoticed Action - OSS atrribution file generator

Create a NOTICE attribution file based on your package-lock.json as a github action!
Maintain a NOTICE file based on your package-lock.json using GitHub Actions!

- uses https://www.npmjs.com/package/tiny-attribution-generator (chive) and https://clearlydefined.io
- optional custom NOTICE_TEMPLATE
- optional argument for filename to use (--filename)
- optional argument for including devDependencies (--includeDev) (excluded by default)
![](https://clearlydefined.io/static/media/logo-text-stacked.d14f6270.svg)

Uses https://www.npmjs.com/package/tiny-attribution-generator (chive) for rendering and https://clearlydefined.io for data

### Options

- custom NOTICE_TEMPLATE you check in to the root or .github folder
- argument for filename to use (--filename). Defaults to NOTICE
- argument for including devDependencies (--includeDev). Defaults to excluded

### How it works

1. Include this Action in your workflow
2. When the Action runs, a pull request will be created with your new NOTICE file
3. Merge the pull request and delete the branch
4. As your dependencies evolve, new pull requests get opened with the changes

add ./github/main.workflow to your repo

```
workflow "NOTICE file generator" {
workflow "My Workflow" {
on = "push"
resolves = ["NOTICE file generator"]
resolves = ["ClearlyNoticed"]
}
action "NOTICE file generator" {
action "ClearlyNoticed" {
uses = "dabutvin/chive-action@master"
secrets = ["GITHUB_TOKEN"]
}
Expand All @@ -24,7 +36,7 @@ action "NOTICE file generator" {
with custom file name argument

```
action "NOTICE file generator" {
action "ClearlyNoticed" {
uses = "dabutvin/chive-action@master"
secrets = ["GITHUB_TOKEN"]
args = "--filename=MyNotices.md"
Expand All @@ -34,7 +46,7 @@ action "NOTICE file generator" {
include devDependencies in notices

```
action "NOTICE file generator" {
action "ClearlyNoticed" {
uses = "dabutvin/chive-action@master"
secrets = ["GITHUB_TOKEN"]
args = "--includeDev=true"
Expand Down
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ function writeFile(filePath, content, branchName, currentSha) {
const payload = {
message: `update ${noticesFileName}`,
committer: {
name: 'chive-action',
email: 'chive.action@gmail.com'
name: 'clearlydefinedbot',
email: '[email protected].com'
},
content,
branch: branchName
Expand Down Expand Up @@ -251,7 +251,9 @@ function getPrBody(coordinates, clearlydefinedSource) {
result += '</details>\n\n'
result += '---\n\n'
result +=
'[:octocat: source](https://github.com/dabutvin/chive-action) | [🏷SPDX licenses](https://spdx.org/licenses/)] | [📘Best practices](https://www.nexb.com/blog/oss_attribution_obligations.html) | [🏪ClearlyDefined](https://clearlydefined.io)'
'Brought to you by [ClearlyDefined](https://clearlydefined.io) and [tiny-attribution-builder](https://github.com/amzn/tiny-attribution-generator).\n\n'
result +=
'[:octocat: source](https://github.com/dabutvin/chive-action) | [🏷SPDX licenses](https://spdx.org/licenses/)] | [📘Best practices](https://www.nexb.com/blog/oss_attribution_obligations.html) | [ 👌Actions](https://github.com/features/actions)'
return result

function yesno(input) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "chive-action",
"version": "1.0.0",
"description": "Generate NOTICE files from package-lock.json",
"version": "1.1.0",
"description": "Create a NOTICE file based on your package-lock.json",
"main": "index.js",
"author": "dabutvin",
"license": "MIT",
Expand Down

0 comments on commit 724409e

Please sign in to comment.