https://github.com/insightsengineering/r-license-report
Github Action to generate an R Package Dependencies' License Report
https://github.com/insightsengineering/r-license-report
github-actions license-checking r
Last synced: about 1 year ago
JSON representation
Github Action to generate an R Package Dependencies' License Report
- Host: GitHub
- URL: https://github.com/insightsengineering/r-license-report
- Owner: insightsengineering
- License: mit
- Created: 2021-06-20T14:47:38.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-15T15:40:56.000Z (about 2 years ago)
- Last Synced: 2025-03-26T12:51:13.836Z (about 1 year ago)
- Topics: github-actions, license-checking, r
- Language: R
- Homepage: https://github.com/marketplace/actions/r-dependency-license-report
- Size: 86.9 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://github.com/insightsengineering/r-license-report/actions/workflows/lint.yaml)
[](https://github.com/insightsengineering/r-license-report/actions/workflows/test.yaml)
# R Dependency License Report
### Description
A Github Action that generates a license report of an R package's dependencies for continuous compliance.
### Action Type
Docker
### Author
Insights Engineering
### Inputs
* `path`:
_Description_: Path to package's root
_Required_: `false`
_Default_: `.`
* `regex`:
_Description_: Regex used for flagging packages with non-compliant licenses
_Required_: `false`
_Default_: `""`
* `fail`:
_Description_: Fail with a non-zero exit code if one or more dependencies are flagged by the regex
_Required_: `false`
_Default_: `True`
* `rspm_snapshot_date`:
_Description_: RSPM snapshot date (in the YYYY-MM-DD format) for package metadata retrieval. Defaults to current date
_Required_: `false`
_Default_: `""`
* `bioc_release`:
_Description_: BioConductor release version for package metadata retrieval
_Required_: `false`
_Default_: `release`
* `as_html`:
_Description_: Whether you also want the report as an `html` file
_Required_: `false`
_Default_: `false`
### Outputs
None
## Usage
To use this GitHub Action you will need to complete the following:
* Create a new file in your repository called `.github/workflows/r-license-report.yml`
* Copy the quickstart workflow from below into that new file, no extra configuration required
* Commit that file to a new branch
* Open up a pull request and observe the action working
* Review the output of the action as needed
### Quickstart
In your repository you should have a `.github/workflows/r-license-report.yml` folder with GitHub Action similar to below:
```yaml
---
name: License Report
on:
push:
branches-ignore: [main]
pull_request:
branches: [main]
jobs:
license-report:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: License Report
uses: insightsengineering/r-license-report@v1
```
### Complete example
The following workflow is a complete example that highlights the available options in this Action:
```yaml
---
name: License Compliance Check
on:
push:
branches-ignore: [main]
pull_request:
branches: [main]
jobs:
license-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Generate License Report
uses: insightsengineering/r-license-report@v1
with:
# R package root path, in case your R package is within a subdirectory of the repo
path: "."
# A regular expression that can be used for matching and flagging non-compliant licenses
regex: "^AGPL.*"
# Fail the action if 1 or more matching non-compliant licenses are found
fail: true
# Select an RSPM snapshot date for CRAN dependency metadata retrieval
rspm_snapshot_date: "2021-12-12"
# Select a Bioconductor release version for BioC dependency metadata retrieval
bioc_release: "3.14"
# Whether you also want the report as an `html` file
as_html: true
- name: Upload PDF Report
uses: actions/upload-artifact@v2
with:
name: license-report.pdf
path: license-report.pdf
```
An example of the output of the action can be seen below:

## Standalone Usage
The underlying script used in this action can also be used as a standalone script, and can be used outside of this action (eg. in other CI/CD tools). Simply:
- Download the script
```bash
wget https://raw.githubusercontent.com/insightsengineering/r-license-report/main/license-report.R
```
- Set execute permissions
```bash
chmod +x license-report.R
```
- Run the script
```bash
./license-report.R --help
```