forked from eclipse/dash-licenses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
49 lines (48 loc) · 1.95 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# *************************************************************************
# * Copyright (c) 2022, 2023 Hannes Wellmann and others.
# *
# * This program and the accompanying materials are made available under
# * the terms of the Eclipse Public License 2.0 which accompanies this
# * distribution, and is available at https://www.eclipse.org/legal/epl-2.0
# *
# * SPDX-License-Identifier: EPL-2.0
# * Hannes Wellmann - initial API and implementation
# *************************************************************************
name: 'Check license vetting status'
description: 'Checks if the licenses of all dependencies are vetted and requests a review in case required and wanted'
inputs:
request-review:
description: ''
required: false
project-id:
description: ''
required: false
outputs:
licenses-vetted:
description: "True if all licenses are vetted, else false"
value: ${{ steps.license-check-with-review-request.outputs.build-succeeded }}
runs:
using: "composite"
steps:
- id: license-check-with-review-request
shell: bash {0} # do not fail-fast
run: |
mvnArgs="-U -B -ntp org.eclipse.dash:license-tool-plugin:license-check -Ddash.fail=true -Dtycho.target.eager=true --settings $GITHUB_ACTION_PATH/licenseCheckMavenSettings.xml"
if [[ ${{ inputs.project-id }} != "" ]]; then
mvnArgs+=" -Ddash.projectId=${{ inputs.project-id }}"
fi
echo "The token is: ${#GITLAB_API_TOKEN}"
if [ ${{ inputs.request-review }} ]; then
mvn ${mvnArgs} -Ddash.iplab.token=$GITLAB_API_TOKEN
if [[ $? == 0 ]]; then # All licenses are vetted
echo "build-succeeded=0" >> $GITHUB_OUTPUT
else
echo "build-succeeded=0" >> $GITHUB_OUTPUT
fi
else
mvn ${mvnArgs}
if [[ $? != 0 ]]; then
echo "Committers can request a review by commenting '/request-license-review'"
exit 1
fi
fi