11name : Valider pull request
2- on : [pull_request]
2+ on : [ pull_request ]
33jobs :
44 valid-pull-request :
55 name : Valider pull request
66 runs-on : ubuntu-latest
77 timeout-minutes : 30
88 steps :
9- - name : Hente kode
10- uses : actions/checkout@v4
9+ - uses : actions/checkout@v4
1110 with :
1211 fetch-depth : 0
1312
14- - name : Sette yarn-config
15- run : |
16- yarn config set npmScopes.navikt.npmRegistryServer "https://npm.pkg.github.com"
17- yarn config set npmScopes.navikt.npmAlwaysAuth true
18- yarn config set npmScopes.navikt.npmAuthToken $NPM_AUTH_TOKEN
19- env :
20- NPM_AUTH_TOKEN : ${{ secrets.READER_TOKEN }}
21-
22- - name : Sette opp Node
23- uses : actions/setup-node@v4
13+ - uses : actions/setup-node@v4
2414 with :
25- node-version : 18.8.0
15+ node-version : 22.17.1
2616 cache : ' yarn'
17+ registry-url : https://npm.pkg.github.com/
18+ always-auth : true
19+ token : ${{ secrets.READER_TOKEN }}
2720
2821 - name : Installere dependencies
2922 run : yarn install --immutable
3023
3124 - name : Bygg
3225 run : yarn build
3326
34- - name : Typescript and linting
35- run : yarn stylelint && yarn eslint:changed && yarn tsc
27+ - name : Stylelint
28+ run : yarn stylelint
29+
30+ - name : ESLint
31+ run : yarn eslint:changed
32+
33+ - name : Typescript
34+ run : yarn tsc
3635
3736 - name : Run test
3837 run : yarn test
38+
39+ knip-it :
40+ name : Kjør knip
41+ runs-on : ubuntu-latest
42+ timeout-minutes : 30
43+ permissions :
44+ contents : read
45+ pull-requests : write
46+ steps :
47+ - uses : actions/checkout@v4
48+ with :
49+ fetch-depth : 0
50+
51+ - uses : actions/setup-node@v4
52+ with :
53+ node-version : 22.17.1
54+ registry-url : https://npm.pkg.github.com/
55+ always-auth : true
56+ token : ${{ secrets.READER_TOKEN }}
57+ cache : ' yarn'
58+
59+ - name : Installere dependencies
60+ run : yarn install --immutable
61+
62+ - name : Run knip
63+ run : |
64+ yarn knip --no-exit-code --reporter=markdown > knip-report.md
65+ cat knip-report.md > $GITHUB_STEP_SUMMARY
66+
67+ - name : Delete previous comments from knip
68+ continue-on-error : true
69+ run : gh pr comment ${{ github.event.pull_request.number }} --delete-last --yes
70+ env :
71+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
72+
73+ - name : Post knip report
74+ run : |
75+ number_of_words=$(wc -w < knip-report.md)
76+ if [ $number_of_words -gt 3 ]; then
77+ gh pr comment ${{ github.event.pull_request.number }} --body-file knip-report.md
78+ fi
79+ env :
80+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments