@@ -6,39 +6,92 @@ name: Licensed
66
77on :
88 pull_request :
9+ paths :
10+ - .github/workflows/licensed.yml
11+ - .licensed.yml
12+ - .licenses/**
13+ - bun.lock
14+ - package.json
915 push :
1016 branches :
1117 - main
18+ paths :
19+ - .github/workflows/licensed.yml
20+ - .licensed.yml
21+ - .licenses/**
22+ - bun.lock
23+ - package.json
1224 workflow_dispatch :
1325
14- permissions :
15- contents : write
26+ concurrency :
27+ group : ${{ github.workflow }}-${{ github.ref }}
28+ cancel-in-progress : true
1629
1730jobs :
18- licensed :
31+ check-licenses :
32+ if : ${{ github.event_name != 'workflow_dispatch' }}
1933 name : Check Licenses
2034 runs-on : ubuntu-latest
35+ timeout-minutes : 15
36+ permissions :
37+ contents : read
2138
2239 steps :
2340 - name : Checkout
2441 id : checkout
2542 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
43+
44+ - name : Setup Bun
45+ id : setup-bun
46+ uses : oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
2647 with :
27- persist-credentials : false
28- - name : Setup Node.js
29- id : setup-node
30- uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
48+ bun-version-file : .bun-version
49+
50+ - name : Install Dependencies
51+ id : bun-install
52+ run : bun install --frozen-lockfile
53+
54+ - name : Setup Ruby
55+ id : setup-ruby
56+ uses : ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
3157 with :
32- node-version-file : .node-version
33- cache : npm
58+ ruby-version : ruby
59+
60+ - uses : licensee/setup-licensed@0d52e575b3258417672be0dff2f115d7db8771d8 # v1.3.2
61+ with :
62+ version : 4.x
63+ github_token : ${{ secrets.GITHUB_TOKEN }}
64+
65+ - name : Check Licenses
66+ id : check-licenses
67+ run : licensed status
68+
69+ update-licenses :
70+ if : ${{ github.event_name == 'workflow_dispatch' }}
71+ name : Update Licenses
72+ runs-on : ubuntu-latest
73+ timeout-minutes : 15
74+ permissions :
75+ contents : write
76+
77+ steps :
78+ - name : Checkout
79+ id : checkout
80+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
81+
82+ - name : Setup Bun
83+ id : setup-bun
84+ uses : oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
85+ with :
86+ bun-version-file : .bun-version
3487
3588 - name : Install Dependencies
36- id : npm-ci
37- run : npm ci
89+ id : bun-install
90+ run : bun install --frozen-lockfile
3891
3992 - name : Setup Ruby
4093 id : setup-ruby
41- uses : ruby/setup-ruby@4dc28cf14d77b0afa6832d9765ac422dbf0dfedd # v1.298 .0
94+ uses : ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299 .0
4295 with :
4396 ruby-version : ruby
4497
@@ -47,24 +100,19 @@ jobs:
47100 version : 4.x
48101 github_token : ${{ secrets.GITHUB_TOKEN }}
49102
50- # If this is a workflow_dispatch event, update the cached licenses.
51- - if : ${{ github.event_name == 'workflow_dispatch' }}
52- name : Update Licenses
103+ - name : Update License Cache
53104 id : update-licenses
54105 run : licensed cache
55106
56- # Then, commit the updated licenses to the repository.
57- - if : ${{ github.event_name == 'workflow_dispatch' }}
58- name : Commit Licenses
107+ - name : Commit Licenses
59108 id : commit-licenses
60109 run : |
61110 git config --local user.email "licensed-ci@users.noreply.github.com"
62111 git config --local user.name "licensed-ci"
63- git add .
112+ git add .licenses .licensed.yml
113+ if git diff --cached --quiet; then
114+ echo "No license cache changes to commit."
115+ exit 0
116+ fi
64117 git commit -m "Auto-update license files"
65118 git push
66-
67- # Last, check the status of the cached licenses.
68- - name : Check Licenses
69- id : check-licenses
70- run : licensed status
0 commit comments