Skip to content

Commit b8c9439

Browse files
committed
legg til actions
1 parent 146b0af commit b8c9439

File tree

4 files changed

+49
-20
lines changed

4 files changed

+49
-20
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Setup + Install
2+
description: Run commands needed to setup yarn and install dependencies.
3+
inputs:
4+
npmAuthToken:
5+
description: Token that has packages:read permission for the navikt organization
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- uses: ./.github/actions/setup-yarnrc
12+
with:
13+
npmAuthToken: ${{ inputs.npmAuthToken }}
14+
15+
- name: Sette opp node
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 22.17.1
19+
cache: yarn
20+
21+
- name: Installere dependencies
22+
shell: bash
23+
run: HUSKY=0 yarn install --immutable
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Setup yarnrc.yml
2+
description: Run yarn config commands so that @navikt/ packages are resolved from github package registry, with neccessary auth.
3+
inputs:
4+
npmAuthToken:
5+
description: Token that has packages:read permission for the navikt organization.
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- shell: bash
12+
run: |
13+
corepack enable
14+
yarn config set npmScopes.navikt.npmRegistryServer "https://npm.pkg.github.com"
15+
yarn config set npmScopes.navikt.npmAlwaysAuth true
16+
yarn config set npmScopes.navikt.npmAuthToken ${{ inputs.npmAuthToken }}

.github/workflows/valider-pull-request.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,10 @@ jobs:
1010
with:
1111
fetch-depth: 0
1212

13-
- uses: actions/setup-node@v4
13+
- name: Setup + Install
14+
uses: ./.github/actions/setup-install
1415
with:
15-
node-version: 22.17.1
16-
cache: 'yarn'
17-
registry-url: https://npm.pkg.github.com
18-
scope: '@navikt'
19-
20-
- name: Installere dependencies
21-
run: yarn install --immutable
22-
env:
23-
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
24-
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
16+
npmAuthToken: ${{ secrets.READER_TOKEN }}
2517

2618
- name: Bygg
2719
run: yarn build
@@ -50,16 +42,10 @@ jobs:
5042
with:
5143
fetch-depth: 0
5244

53-
- uses: actions/setup-node@v4
45+
- name: Setup + Install
46+
uses: ./.github/actions/setup-install
5447
with:
55-
node-version: 22.17.1
56-
cache: 'yarn'
57-
58-
- name: Installere dependencies
59-
run: yarn install --immutable
60-
env:
61-
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
62-
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
48+
npmAuthToken: ${{ secrets.READER_TOKEN }}
6349

6450
- name: Run knip
6551
run: |
@@ -80,3 +66,6 @@ jobs:
8066
fi
8167
env:
8268
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
22:
70+
17:
71+
1:

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ npmScopes:
55
navikt:
66
npmAlwaysAuth: true
77
npmRegistryServer: "https://npm.pkg.github.com"
8+
npmAuthToken: ${NPM_AUTH_TOKEN}
89

910
plugins:
1011
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

0 commit comments

Comments
 (0)