Skip to content

Commit

Permalink
fixing environment variable access
Browse files Browse the repository at this point in the history
fixing environment variable access
  • Loading branch information
amauch-adobe committed Dec 18, 2024
1 parent 01e6c07 commit a24bccb
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/servicenow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,21 @@ def find_string_in_json(json_data, target_string):
end_time = (datetime.datetime.now() + datetime.timedelta(minutes = 10)).timestamp()

print("Set Release Summary for CMR...")
release_title = process.env.PR_TITLE
release_details = process.env.PR_BODY
release_summary = f"Release_Details: {release_details} \n\nPull Request Number: {process.env.PR_NUMBER} \nPull Request Created At: {process.env.PR_CREATED_AT} \nPull Request Merged At: {process.env.PR_MERGED_AT}"
release_title = os.environ['PR_TITLE']
release_details = os.environ['PR_BODY']
pr_num = os.environ['PR_NUMBER']
pr_created = os.environ['PR_CREATED_AT']
pr_merged = os.environ['PR_MERGED_AT']
release_summary = f"Release_Details: {release_details} \n\nPull Request Number: {pr_num} \nPull Request Created At: {pr_created} \nPull Request Merged At: {pr_merged}"

print("Getting IMS Token")
ims_url = 'https://ims-na1-stg1.adobelogin.com/ims/token'
headers = {"Content-Type":"multipart/form-data"}
data = {
'client_id': process.env.IMSACCESS_CLIENT_ID,
'client_secret': process.env.IMSACCESS_CLIENT_SECRET,
'client_id': os.environ['IMSACCESS_CLIENT_ID'],
'client_secret': os.environ['IMSACCESS_CLIENT_SECRET'],
'grant_type': "authorization_code",
'code': process.env.IMSACCESS_AUTH_CODE
'code': os.environ['IMSACCESS_AUTH_CODE']
}
response = requests.post(ims_url, data=data)
jsonParse = json.loads(response.text)
Expand All @@ -81,7 +84,7 @@ def find_string_in_json(json_data, target_string):
"Accept":"application/json",
"Authorization":token,
"Content-Type":"application/json",
"api_key":process.env.IPAAS_KEY
"api_key":os.environ['IPAAS_KEY']
}
data = {
"title":release_title,
Expand Down Expand Up @@ -121,7 +124,7 @@ def find_string_in_json(json_data, target_string):
headers = {
"Accept":"application/json",
"Authorization":token,
"api_key":process.env.IPAAS_KEY
"api_key":os.environ['IPAAS_KEY']
}

# Wait 10 seconds to provide time for the transaction to exit the queue and be saved into ServiceNow as a CMR record.
Expand Down Expand Up @@ -151,7 +154,7 @@ def find_string_in_json(json_data, target_string):
"Accept":"application/json",
"Authorization":token,
"Content-Type":"application/json",
"api_key":process.env.IPAAS_KEY
"api_key":os.environ['IPAAS_KEY']
}
data = {
"id": transaction_id,
Expand Down

0 comments on commit a24bccb

Please sign in to comment.