Skip to content

Commit 31cc4d3

Browse files
authored
chore(gha): update npm.yml GitHub workflow (#112)
1 parent 98e00c4 commit 31cc4d3

File tree

1 file changed

+49
-20
lines changed

1 file changed

+49
-20
lines changed

.github/workflows/npm.yml

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# If changes are needed, update the action npm in
44
# https://github.com/mobsuccess-devops/github-mobsuccess-policy
55
on:
6+
merge_group:
7+
types:
8+
- checks_requested
69
push:
710
branches: [master, preprod, prod]
811
pull_request:
@@ -11,28 +14,54 @@ name: NPM
1114
jobs:
1215
packagejsonlint:
1316
name: PackageJsonLint
14-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-24.04
1518
timeout-minutes: 1
1619
steps:
17-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1821
- uses: mobsuccess-devops/github-actions-packagejsonlint@master
22+
sortpackagejson:
23+
name: Sort Package Json
24+
runs-on: ubuntu-24.04
25+
timeout-minutes: 7
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: 20.12.0
31+
- name: Cache Node Modules
32+
id: cache
33+
uses: actions/cache@v4
34+
env:
35+
cache-name: cache-node-modules
36+
with:
37+
path: ./node_modules
38+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
39+
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
40+
name: Configure Credentials For GitHub Packages
41+
- run: npm ci
42+
if: steps.cache.outputs.cache-hit != 'true'
43+
working-directory: .
44+
- run: |
45+
echo "💡 👉 Check not passing? see the doc at https://www.notion.so/mobsuccess/sort-package-json-de5cf4648e8545dbb5a2a5a910380535"
46+
npx --yes [email protected] --check
47+
working-directory: .
1948
prettier:
2049
name: Prettier
21-
runs-on: ubuntu-20.04
50+
runs-on: ubuntu-24.04
2251
timeout-minutes: 7
2352
steps:
24-
- uses: actions/checkout@v3
25-
- uses: actions/setup-node@v3
53+
- uses: actions/checkout@v4
54+
- uses: actions/setup-node@v4
2655
with:
27-
node-version: 16.16.0
56+
node-version: 20.12.0
2857
- name: Cache Node Modules
2958
id: cache
30-
uses: actions/cache@v3
59+
uses: actions/cache@v4
3160
env:
3261
cache-name: cache-node-modules
3362
with:
3463
path: ./node_modules
35-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
64+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
3665
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
3766
name: Configure Credentials For GitHub Packages
3867
- run: npm ci
@@ -42,21 +71,21 @@ jobs:
4271
working-directory: .
4372
eslint:
4473
name: Eslint
45-
runs-on: ubuntu-20.04
74+
runs-on: ubuntu-24.04
4675
timeout-minutes: 7
4776
steps:
48-
- uses: actions/checkout@v3
49-
- uses: actions/setup-node@v3
77+
- uses: actions/checkout@v4
78+
- uses: actions/setup-node@v4
5079
with:
51-
node-version: 16.16.0
80+
node-version: 20.12.0
5281
- name: Cache Node Modules
5382
id: cache
54-
uses: actions/cache@v3
83+
uses: actions/cache@v4
5584
env:
5685
cache-name: cache-node-modules
5786
with:
5887
path: ./node_modules
59-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
88+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
6089
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
6190
name: Configure Credentials For GitHub Packages
6291
- run: npm ci
@@ -66,21 +95,21 @@ jobs:
6695
working-directory: .
6796
test:
6897
name: Test
69-
runs-on: ubuntu-20.04
98+
runs-on: ubuntu-24.04
7099
timeout-minutes: 7
71100
steps:
72-
- uses: actions/checkout@v3
73-
- uses: actions/setup-node@v3
101+
- uses: actions/checkout@v4
102+
- uses: actions/setup-node@v4
74103
with:
75-
node-version: 16.16.0
104+
node-version: 20.12.0
76105
- name: Cache Node Modules
77106
id: cache
78-
uses: actions/cache@v3
107+
uses: actions/cache@v4
79108
env:
80109
cache-name: cache-node-modules
81110
with:
82111
path: ./node_modules
83-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
112+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
84113
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
85114
name: Configure Credentials For GitHub Packages
86115
- run: npm ci

0 commit comments

Comments
 (0)