File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : ' Update Academy'
2
+ description : ' Triggers update of academy content for a given orgId and version using an API'
3
+ author : ' Layer5'
4
+ inputs :
5
+ orgId :
6
+ description : ' Organization ID to update academy content for'
7
+ required : true
8
+ token :
9
+ description : ' Bearer token for authorization'
10
+ required : true
11
+ version :
12
+ description : ' Version of the module to update. Defaults to "latest"'
13
+ required : false
14
+ default : ' latest'
15
+ outputs :
16
+ response :
17
+ value : ${{ steps.update.outputs.RESOURCE_URL }}
18
+ description : ' Response from the API call'
19
+ runs :
20
+ using : ' composite'
21
+ steps :
22
+ - name : Call academy update API
23
+ shell : bash
24
+ id : update
25
+ run : |
26
+ set -e
27
+ RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "http://cloud.layer5.io/api/academy/${{ inputs.orgId }}/update/${{ inputs.version }}" \
28
+ -H "Authorization: Bearer ${{ inputs.token }}" \
29
+ -H "Content-Type: application/json")
30
+
31
+ BODY=$(echo "$RESPONSE" | head -n -1)
32
+ STATUS=$(echo "$RESPONSE" | tail -n1)
33
+
34
+ echo "API response status: $STATUS"
35
+ echo "API response body: $BODY"
36
+
37
+ if [[ "$STATUS" -ge 200 && "$STATUS" -lt 300 ]]; then
38
+ echo "response<<EOF" >> $GITHUB_OUTPUT
39
+ echo "$BODY" >> $GITHUB_OUTPUT
40
+ echo "EOF" >> $GITHUB_OUTPUT
41
+ else
42
+ echo "::error::Failed to update academy (HTTP $STATUS): $BODY"
43
+ exit 1
44
+ fi
You can’t perform that action at this time.
0 commit comments