Skip to content

Commit

Permalink
feat: add ci action to check for unsorter package.json files
Browse files Browse the repository at this point in the history
     - Remove not working check-package-json-sort.ts script.
     - Add ci action to check for unsorted package.json files.

Closes: #2356
Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com>
  • Loading branch information
rwat17 committed May 23, 2023
1 parent 3e6d908 commit 5b9439d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 74 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/sort-package-json-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: sort-package-json-check
on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true


jobs:
sort-package-json-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "14"
- run: npm install --global sort-package-json
- run: ./tools/ci-package-json-check.sh
20 changes: 20 additions & 0 deletions tools/ci-package-json-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
country=$(sort-package-json "**/cactus-*/package.json" --check )


echo "${country}"

if [[ "${country}" =~ 'not sorted' ]]
then
echo 1 'not sorted.
Run
$ find -wholename "**/cactus-*/package.json" -type f -not -path "**/node_modules/*" -exec sort-package-json {} +;
in cactus root.'
exit 1
elif [[ "${country}" =~ 'already sorted' ]]
then
echo 0 'sorted'
exit 0
else
echo 1 'some error occured' "${country}"
exit 1
fi
74 changes: 0 additions & 74 deletions tools/custom-checks/check-package-json-sort.ts

This file was deleted.

0 comments on commit 5b9439d

Please sign in to comment.