From 49b48bf314b01d53e333cea12865644b345f9609 Mon Sep 17 00:00:00 2001 From: Mobsuccess Bot Date: Thu, 25 Jul 2024 10:43:44 +0000 Subject: [PATCH] chore(gha): update npm.yml GitHub workflow --- .github/workflows/npm.yml | 49 +++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index 1abfa7cf6..40a0c23a3 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -3,6 +3,9 @@ # If changes are needed, update the action npm in # https://github.com/mobsuccess-devops/github-mobsuccess-policy on: + merge_group: + types: + - checks_requested push: branches: [master, preprod, prod] pull_request: @@ -14,17 +17,43 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 1 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: mobsuccess-devops/github-actions-packagejsonlint@master + sortpackagejson: + name: Sort Package Json + runs-on: ubuntu-20.04 + timeout-minutes: 7 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 20.12.0 + - name: Cache Node Modules + id: cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: ./node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0 + - run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc + name: Configure Credentials For GitHub Packages + - run: npm ci + if: steps.cache.outputs.cache-hit != 'true' + working-directory: . + - run: | + echo "💡 👉 Check not passing? see the doc at https://www.notion.so/mobsuccess/sort-package-json-de5cf4648e8545dbb5a2a5a910380535" + npx --yes sort-package-json@2.4.1 --check + working-directory: . prettier: name: Prettier runs-on: ubuntu-20.04 timeout-minutes: 7 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: - node-version: 16.16.0 + node-version: 20.12.0 - name: Cache Node Modules id: cache uses: actions/cache@v3 @@ -32,7 +61,7 @@ jobs: cache-name: cache-node-modules with: path: ./node_modules - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0 + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0 - run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc name: Configure Credentials For GitHub Packages - run: npm ci @@ -45,10 +74,10 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 7 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: - node-version: 16.16.0 + node-version: 20.12.0 - name: Cache Node Modules id: cache uses: actions/cache@v3 @@ -56,7 +85,7 @@ jobs: cache-name: cache-node-modules with: path: ./node_modules - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0 + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0 - run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc name: Configure Credentials For GitHub Packages - run: npm ci @@ -69,10 +98,10 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 7 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: - node-version: 16.16.0 + node-version: 20.12.0 - name: Cache Node Modules id: cache uses: actions/cache@v3 @@ -80,7 +109,7 @@ jobs: cache-name: cache-node-modules with: path: ./node_modules - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0 + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0 - run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc name: Configure Credentials For GitHub Packages - run: npm ci