@@ -4,14 +4,42 @@ name: mend
4
4
5
5
on :
6
6
workflow_call :
7
+ inputs :
8
+ api_key :
9
+ default : ' '
10
+ type : string
11
+ token :
12
+ default : ' '
13
+ type : string
14
+ product_name :
15
+ default : ' content-and-tooling'
16
+ type : string
7
17
8
- jobs :
18
+ env :
19
+ MEND_API_KEY : ${{ secrets.MEND_API_KEY != '' && secrets.MEND_API_KEY || inputs.api_key }}
20
+ MEND_TOKEN : ${{ secrets.MEND_TOKEN != '' && secrets.MEND_TOKEN || inputs.token }}
21
+ PRODUCT_NAME : ${{ inputs.PRODUCT_NAME != '' && inputs.PRODUCT_NAME || inputs.product_name }}
22
+ REQUIRE_SECRETS : MEND_API_KEY MEND_TOKEN
9
23
24
+ jobs :
10
25
mend :
11
26
runs-on : " ubuntu-latest"
27
+ continue-on-error : ${{ contains(fromJson('["puppetlabs","puppet-toy-chest"]'), github.repository_owner) != true }}
12
28
steps :
29
+ - name : " check requirements"
30
+ run : |
31
+ declare -a MISSING
32
+ for V in ${REQUIRE_SECRETS} ; do
33
+ [[ -z "${!V}" ]] && MISSING+=($V)
34
+ done
35
+ if [ ${#MISSING[@]} -gt 0 ] ; then
36
+ echo "::warning::missing required secrets: ${MISSING[@]}"
37
+ exit 1
38
+ fi
39
+
13
40
# If we are on a PR, checkout the PR head sha, else checkout the default branch
14
41
- name : " Set the checkout ref"
42
+ if : success()
15
43
id : set_ref
16
44
run : |
17
45
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
@@ -21,32 +49,38 @@ jobs:
21
49
fi
22
50
23
51
- name : " checkout"
52
+ if : success()
24
53
uses : " actions/checkout@v4"
25
54
with :
26
55
fetch-depth : 1
27
56
ref : ${{ steps.set_ref.outputs.ref }}
28
57
29
58
- name : " setup ruby"
59
+ if : success()
30
60
uses : " ruby/setup-ruby@v1"
31
61
with :
32
62
ruby-version : 2.7
33
63
34
64
- name : " bundle lock"
65
+ if : success()
35
66
run : bundle lock
36
67
37
68
- uses : " actions/setup-java@v4"
69
+ if : success()
38
70
with :
39
71
distribution : " temurin"
40
72
java-version : " 17"
41
73
42
74
- name : " download"
75
+ if : success()
43
76
run : curl -o wss-unified-agent.jar https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
44
77
45
78
- name : " scan"
79
+ if : success()
46
80
run : java -jar wss-unified-agent.jar
47
81
env :
48
- WS_APIKEY : ${{ secrets .MEND_API_KEY }}
82
+ WS_APIKEY : ${{ env .MEND_API_KEY }}
49
83
WS_WSS_URL : https://saas-eu.whitesourcesoftware.com/agent
50
- WS_USERKEY : ${{ secrets .MEND_TOKEN }}
51
- WS_PRODUCTNAME : " content-and-tooling "
52
- WS_PROJECTNAME : ${{ github.event.repository.name }}
84
+ WS_USERKEY : ${{ env .MEND_TOKEN }}
85
+ WS_PRODUCTNAME : ${{ env.PRODUCT_NAME }}
86
+ WS_PROJECTNAME : ${{ github.event.repository.name }}
0 commit comments