License Verification #383
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: License Verification | |
on: | |
schedule: | |
# 00:00 AM (KST) Mon-Fri | |
- cron: '00 15 * * 0-4' | |
jobs: | |
license_verification: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- run: npm install | |
- run: npx license-checker --unknown --json --out license_list.json | |
- shell: bash | |
run: npx ts-node infra/license/license-checker.ts license_list.json ${{ matrix.os }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}.json | |
path: ${{ matrix.os }}.json | |
retention-days: 1 | |
report_verification_result: | |
runs-on: ubuntu-latest | |
needs: [ license_verification ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- id: get_commit_id | |
run: | | |
COMMIT_ID=$(git log -1 --format='%H') | |
echo "::set-output name=commit_id::${COMMIT_ID}" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: ubuntu-latest.json | |
- uses: actions/download-artifact@v3 | |
with: | |
name: macos-latest.json | |
- uses: actions/download-artifact@v3 | |
with: | |
name: windows-latest.json | |
- run: npm install | |
- run: npx ts-node infra/license/check-result-formatter.ts ubuntu-latest.json windows-latest.json macos-latest.json | |
- uses: actions/github-script@v6 | |
if: ${{ hashFiles('license_check_result.fail') }} | |
with: | |
script: | | |
var fs = require('fs'); | |
var body_content = 'Verified with ${{ steps.get_commit_id.outputs.commit_id }}\n\n---\n\n'; | |
body_content += fs.readFileSync('license_check_result.md', 'utf-8'); | |
github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: '[CI] License Verification Warning/Failure', | |
body: body_content, | |
labels: ['Bug/Issue'] | |
}); |