|
| 1 | +name: Check - Yarn and dependencies |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - ".github/actions/yarn-project-setup/**" |
| 7 | + - ".github/workflows/check-yarn.yaml" |
| 8 | + - "package.json" |
| 9 | + - "yarn.lock" |
| 10 | + workflow_call: |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + duplicate-dependencies: |
| 15 | + name: Check for duplicate dependencies |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 20 | + - name: Setup yarn tools |
| 21 | + uses: ./.github/actions/yarn-project-setup |
| 22 | + - name: Check for duplicate dependencies |
| 23 | + run: yarn run check:yarn:dedupe |
| 24 | + |
| 25 | + yarn-install-errors: |
| 26 | + name: Validate Yarn install does not contain errors |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 31 | + - name: Setup project |
| 32 | + uses: ./.github/actions/yarn-project-setup |
| 33 | + - name: Yarn install output check |
| 34 | + run: | |
| 35 | + errors=$(yarn install --json | jq 'select(.displayName != "YN0000")') |
| 36 | + error_count=$(echo "$errors" | jq -s 'length') |
| 37 | + if [ "$error_count" -gt 0 ]; then |
| 38 | + echo "Detected Yarn install errors: $error_count" |
| 39 | + echo -e "$errors" |
| 40 | + exit 1 |
| 41 | + fi |
| 42 | +
|
| 43 | + peer-requirements: |
| 44 | + name: Validate yarn peer requirements |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 49 | + - name: Setup project |
| 50 | + uses: ./.github/actions/yarn-project-setup |
| 51 | + - name: Validate peer requirements are defined |
| 52 | + run: | |
| 53 | + reqs=$(yarn explain peer-requirements) |
| 54 | + echo "$reqs" | grep '✘' || true |
| 55 | + echo "$reqs" | grep -q '✘' && exit 1 || exit 0 |
0 commit comments