Skip to content

Commit e21c5d1

Browse files
authored
feat: add frontend dependencies check workflow (#72)
1 parent 767905e commit e21c5d1

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
###############################################################
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License, Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0.
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
#
17+
# SPDX-License-Identifier: Apache-2.0
18+
###############################################################
19+
20+
name: Check Frontend Dependencies
21+
22+
on:
23+
push:
24+
branches: [main]
25+
paths:
26+
- ichub-frontend/package-lock.json
27+
- DEPENDENCIES_ICHUB-FRONTEND
28+
- .github/workflows/dependencies-frontend.yaml
29+
pull_request:
30+
types: [opened, synchronize, reopened]
31+
paths:
32+
- ichub-frontend/package-lock.json
33+
- DEPENDENCIES_ICHUB-FRONTEND
34+
- .github/workflows/dependencies-frontend.yaml
35+
workflow_dispatch:
36+
37+
jobs:
38+
check-dependencies:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Set up JDK 17
43+
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
44+
with:
45+
distribution: 'temurin'
46+
java-version: '17'
47+
48+
- name: Checkout repository
49+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50+
51+
- name: Generate Dependencies file
52+
run: |
53+
curl -L --output ./dash.jar 'https://repo.eclipse.org/service/local/artifact/maven/redirect?r=dash-licenses&g=org.eclipse.dash&a=org.eclipse.dash.licenses&v=LATEST'
54+
55+
java -jar ./dash.jar ichub-frontend/package-lock.json -project automotive.tractusx -summary DEPENDENCIES_ICHUB-FRONTEND || true
56+
57+
- name: Check if dependencies were changed
58+
id: dependencies-changed
59+
run: |
60+
changed=$(git diff DEPENDENCIES_ICHUB-FRONTEND)
61+
if [[ -n "$changed" ]]; then
62+
echo "dependencies changed"
63+
echo "changed=true" >> $GITHUB_OUTPUT
64+
else
65+
echo "dependencies not changed"
66+
echo "changed=false" >> $GITHUB_OUTPUT
67+
fi
68+
69+
- name: Check for restricted dependencies
70+
run: |
71+
restricted=$(grep ' restricted,' DEPENDENCIES_ICHUB-FRONTEND || true)
72+
if [[ -n "$restricted" ]]; then
73+
echo "The following dependencies are restricted: $restricted"
74+
exit 1
75+
fi
76+
if: steps.dependencies-changed.outputs.changed == 'true'
77+
78+
- name: Upload DEPENDENCIES_ICHUB-FRONTEND file
79+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
80+
with:
81+
path: DEPENDENCIES_ICHUB-FRONTEND
82+
if: steps.dependencies-changed.outputs.changed == 'true'
83+
84+
- name: Signal need to update DEPENDENCIES_ICHUB
85+
run: |
86+
echo "Dependencies need to be updated (updated DEPENDENCIES_ICHUB file has been uploaded to workflow run)"
87+
exit 1
88+
if: steps.dependencies-changed.outputs.changed == 'true'

0 commit comments

Comments
 (0)