forked from Samsung/ONE-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (66 loc) · 2.19 KB
/
check-daily-license.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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']
});