Skip to content

Commit

Permalink
action
Browse files Browse the repository at this point in the history
  • Loading branch information
sqin2019 committed Oct 26, 2023
1 parent 2115d0e commit 82974e8
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 211 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: check

on:
pull_request:
branches:
- 'main'
workflow_dispatch:


jobs:
scancode_job:
name: Scan code for licenses
uses: 'sqin2019/scancode/.github/workflows/reusable-scancode.yml@main'


31 changes: 5 additions & 26 deletions .github/workflows/reusable-scancode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ name: reusable-scancode

on:
workflow_call:
inputs:
config:
description: 'Scancode config'
type: 'string'
required: false

env:
dir: 'scancode/snapshot-file-change'
Expand All @@ -17,29 +12,13 @@ jobs:
name: Scan code for licenses
steps:
- uses: 'actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9' # ratchet:actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: 'Get changed files'
id: 'changed-files'
uses: 'tj-actions/changed-files@fb20f4d24890fadc539505b1746d260504b213d0' # ratchet:tj-actions/changed-files@v36
- name: 'Copy changed files'
id: 'copy-changed-files'
run: |
sudo mkdir -p ${{ env.dir }}
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
sudo cp --parents $file ${{ env.dir }}
echo "$file was copied to ${{ env.dir }}"
done
- run: |
ls .
- name: Scan the code
id: scancode
uses: sqin2019/scancode@main
with:
directory-to-scan: '${{ env.dir }}'
config: '${{ inputs.config || ''default_license_config.yml''}}'

- name: Verify
- name: 'json'
run: |
cat ./artifacts/scancode.json
- name: 'cvs'
run: |
test ! -s ./artifacts/report.txt || (cat ./artifacts/report.txt && exit 1 )
cat ./artifacts/scancode.json
2 changes: 0 additions & 2 deletions scripts/action.dockerfile → action.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM ghcr.io/zephyrproject-rtos/scancode:v1.0.0

COPY entrypoint.sh /entrypoint.sh
COPY license_check.py /license_check.py
COPY default_license_config.yml /default_license_config.yml

ENTRYPOINT ["/entrypoint.sh"]
5 changes: 0 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ inputs:
description: 'Which directory to scan'
required: false
default: '.'
config:
description: 'Scancode config file'
required: false
default: 'default_license_config.yml'
runs:
using: 'docker'
image: 'scripts/action.dockerfile'
args:
- ${{ inputs.directory-to-scan }}
- ${{ inputs.config }}
Empty file removed empty.sh
Empty file.
5 changes: 1 addition & 4 deletions scripts/entrypoint.sh → entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@ cd /scancode-toolkit
--verbose /github/workspace/$1 \
--processes `expr $(nproc --all) - 1` \
--json /github/workspace/artifacts/scancode.json \
--html /github/workspace/artifacts/scancode.html


python /license_check.py -c /github/workspace/$2 -s /github/workspace/artifacts/scancode.json -f /github/workspace/$1 -o /github/workspace/artifacts/report.txt
--csv /github/workspace/artifacts/scancode.csv
33 changes: 0 additions & 33 deletions scripts/default_license_config.yml

This file was deleted.

136 changes: 0 additions & 136 deletions scripts/license_check.py

This file was deleted.

0 comments on commit 82974e8

Please sign in to comment.