Skip to content

Commit 29dab15

Browse files
committed
reusable action for yarnrc setup.
For å redusere duplisering av kode i build pipeline.
1 parent 363cd9b commit 29dab15

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed
+16
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/lint-tscheck-build.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,9 @@ jobs:
1616
- name: Hente kode
1717
uses: actions/checkout@v4
1818

19-
- name: Setup .yarnrc.yml
20-
run: |
21-
yarn config set npmScopes.navikt.npmRegistryServer "https://npm.pkg.github.com"
22-
yarn config set npmScopes.navikt.npmAlwaysAuth true
23-
yarn config set npmScopes.navikt.npmAuthToken $NPM_AUTH_TOKEN
24-
env:
25-
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
19+
- uses: ./.github/actions/setup-yarnrc
20+
with:
21+
npmAuthToken: ${{ secrets.READER_TOKEN }}
2622

2723
- name: Sette opp Node
2824
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)