Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Commit 6f3d419

Browse files
committed
Add npm.yml GitHub workflow
1 parent 3e374b5 commit 6f3d419

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

.github/workflows/npm.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# DO NOT EDIT: BEGIN
2+
# This snippet has been inserted automatically by mobsuccessbot, do not edit!
3+
# If changes are needed, update the action npm in
4+
# https://github.com/mobsuccess-devops/github-mobsuccess-policy
5+
on:
6+
merge_group:
7+
types:
8+
- checks_requested
9+
push:
10+
branches: [master, preprod, prod]
11+
pull_request:
12+
types: [opened, synchronize, reopened]
13+
name: NPM
14+
jobs:
15+
packagejsonlint:
16+
name: PackageJsonLint
17+
runs-on: ubuntu-20.04
18+
timeout-minutes: 1
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: mobsuccess-devops/github-actions-packagejsonlint@master
22+
sortpackagejson:
23+
name: Sort Package Json
24+
runs-on: ubuntu-20.04
25+
timeout-minutes: 7
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: actions/setup-node@v3
29+
with:
30+
node-version: 16.16.0
31+
- name: Cache Node Modules
32+
id: cache
33+
uses: actions/cache@v3
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-16.16.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+
# Check not passing? see the doc at https://www.notion.so/mobsuccess/sort-package-json-de5cf4648e8545dbb5a2a5a910380535
45+
- run: npx --yes [email protected] --check
46+
working-directory: .
47+
prettier:
48+
name: Prettier
49+
runs-on: ubuntu-20.04
50+
timeout-minutes: 7
51+
steps:
52+
- uses: actions/checkout@v3
53+
- uses: actions/setup-node@v3
54+
with:
55+
node-version: 16.16.0
56+
- name: Cache Node Modules
57+
id: cache
58+
uses: actions/cache@v3
59+
env:
60+
cache-name: cache-node-modules
61+
with:
62+
path: ./node_modules
63+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
64+
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
65+
name: Configure Credentials For GitHub Packages
66+
- run: npm ci
67+
if: steps.cache.outputs.cache-hit != 'true'
68+
working-directory: .
69+
- run: npm run prettier
70+
working-directory: .
71+
eslint:
72+
name: Eslint
73+
runs-on: ubuntu-20.04
74+
timeout-minutes: 7
75+
steps:
76+
- uses: actions/checkout@v3
77+
- uses: actions/setup-node@v3
78+
with:
79+
node-version: 16.16.0
80+
- name: Cache Node Modules
81+
id: cache
82+
uses: actions/cache@v3
83+
env:
84+
cache-name: cache-node-modules
85+
with:
86+
path: ./node_modules
87+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
88+
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
89+
name: Configure Credentials For GitHub Packages
90+
- run: npm ci
91+
if: steps.cache.outputs.cache-hit != 'true'
92+
working-directory: .
93+
- run: npm run eslint
94+
working-directory: .
95+
test:
96+
name: Test
97+
runs-on: ubuntu-20.04
98+
timeout-minutes: 7
99+
steps:
100+
- uses: actions/checkout@v3
101+
- uses: actions/setup-node@v3
102+
with:
103+
node-version: 16.16.0
104+
- name: Cache Node Modules
105+
id: cache
106+
uses: actions/cache@v3
107+
env:
108+
cache-name: cache-node-modules
109+
with:
110+
path: ./node_modules
111+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
112+
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
113+
name: Configure Credentials For GitHub Packages
114+
- run: npm ci
115+
if: steps.cache.outputs.cache-hit != 'true'
116+
working-directory: .
117+
- run: npm run test
118+
working-directory: .
119+
# DO NOT EDIT: END

0 commit comments

Comments
 (0)