Skip to content

Commit

Permalink
sending in workflow run values
Browse files Browse the repository at this point in the history
  • Loading branch information
amauch-adobe committed Sep 2, 2023
1 parent ba7731e commit f42eb4d
Showing 1 changed file with 4 additions and 33 deletions.
37 changes: 4 additions & 33 deletions .github/workflows/skms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,15 @@ jobs:
# Run command for creating CMR in SKMS system
- run: |
start_date=$(TZ=":America/Los_Angeles" date -d "5 minutes ago" '+%Y-%m-%d %H:%M')
DEFAULT_SKMS_URL='api.skms.adobe.com'
function skms_request() {
local username=$1
local passkey=$2
local object=$3
local method=$4
local mw_start_time=$5
local mw_end_time=$6
local change_summary=$7
local method_params=$8
local url=$9
local method_params=$5
local url=$6
if [ -z "$username" ]; then
echo "First parameter missing, must be SKMS username"
Expand All @@ -71,21 +67,6 @@ jobs:
return 1
fi
if [ -z "$mw_start_time" ]; then
echo "Fifth parameter missing, must be a formatted datetime"
return 1
fi
if [ -z "$mw_end_time" ]; then
echo "Sixth parameter missing, must be a formatted datetime"
return 1
fi
if [ -z "$change_summary" ]; then
echo "Seventh parameter missing, must be a SKMS summary text"
return 1
fi
if [ -z "$method_params" ]; then
method_params='{}'
fi
Expand All @@ -94,12 +75,7 @@ jobs:
url=$DEFAULT_SKMS_URL
fi
echo "SKMS_Request Debug Values: "
echo $mw_start_time
echo $mw_end_time
echo $summary
local params="{\"_username\":\"${username}\",\"_passkey\":\"${passkey}\",\"_object\":\"${object}\",\"_method\":\"${method}\",\"maintenance_window_start_time\":\"${mw_start_time}\",\"maintenance_window_end_time\":\"${mw_end_time}\",\"summary\":\"${change_summary}\"}"
local params="{\"_username\":\"${username}\",\"_passkey\":\"${passkey}\",\"_object\":\"${object}\",\"_method\": \"${method}\"}"
params=$(echo "$params $method_params" | jq -s add)
local response=$(curl --write-out "%{http_code}" --silent --output response.txt https://${url}/web_api --data-urlencode "_parameters=${params}")
Expand Down Expand Up @@ -131,12 +107,7 @@ jobs:
echo "$str"
}
end_date=$(TZ=":America/Los_Angeles" date '+%Y-%m-%d %H:%M')
release_title=$(sanitizeStr "${{ github.event.pull_request.title }}")
release_details=$(sanitizeStr "${{ github.event.pull_request.body }}")
summary=Release_Title:"$release_title"::Release_Details:"$release_details"::PR_Number:"${{ github.event.pull_request.number }}"::PR_Created_At:"${{ github.event.pull_request.created_at }}"::PR_Merged_At:"${{ github.event.pull_request.merged_at }}"
echo "$start_date"
echo "$end_date"
echo "$summary"
skms_request '${{ secrets.SKMS_USER }}' '${{ secrets.SKMS_PASS }}' CmrDao createCmrFromPreapprovedChangeModel '${start_date}' '${end_date}' '${summary}' '{"change_executor":"${{ github.actor }}","preapproved_change_model_id":"${{ secrets.SKMS_CHANGE_MODEL_ID }}"}'
skms_request '${{ secrets.SKMS_USER }}' '${{ secrets.SKMS_PASS }}' CmrDao createCmrFromPreapprovedChangeModel '{"change_executor":"${{ github.actor }}","maintenance_window_end_time":"${{ github.event.workflow_run.updated_at }}","maintenance_window_start_time":"${{ github.event.workflow_run.created_at}}","preapproved_change_model_id":"${{ secrets.SKMS_CHANGE_MODEL_ID }}","summary":"Release Title:"'"${release_title}"'"::"'"${release_details}"'"::Pull Request Number:${{ github.event.pull_request.number }}::Pull Request Created at:${{ github.event.pull_request.created_at }}::Pull Request Merged at:${{ github.event.pull_request.merged_at }}"}'

0 comments on commit f42eb4d

Please sign in to comment.