Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change request output #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ deploy:
runs-on: ubuntu-latest
steps:
- name: ServiceNow Change
uses: ServiceNow/[email protected]
id: ServiceNowCR
uses: ServiceNow/[email protected]
with:
devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }}
devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }}
Expand All @@ -39,6 +40,11 @@ deploy:
change-request: '{"setCloseCode":"true","attributes":{"short_description":"Automated Software Deployment","description":"Automated Software Deployment.","assignment_group":"a715cd759f2002002920bde8132e7018","implementation_plan":"Software update is tested and results can be found in Test Summaries Tab; When the change is approved the implementation happens automated by the CICD pipeline within the change planned start and end time window.","backout_plan":"When software fails in production, the previous software release will be re-deployed.","test_plan":"Testing if the software was successfully deployed"}}'
interval: '100'
timeout: '3600'
changeCreationTimeOut: '3600'
abortOnChangeCreationFailure: true
abortOnChangeStepTimeout: true
- name: Show CR Output Example
run: echo "ServiceNOW Change Request: ${{ steps.ServiceNowCR.outputs.change_number }}"
```
The values for secrets should be setup in Step 1. Secrets should be created in Step 2.

Expand Down Expand Up @@ -81,7 +87,10 @@ The time in seconds to wait between trying the API. The default value is 100 sec
The max. time in seconds to wait until the action should fail. The default value is 3600 seconds.

## Outputs
No outputs produced.

### `change_number`

The newly created Change Request Number from ServiceNOW

# Notices

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ inputs:
description: 'This value will be used to resume or abort the pipeline after a timeout has occurred in case a change step is still in a pending state.'
required: false
default: true
outputs:
change_number:
description: 'ServiceNow Change Request Number'
branding:
icon: 'refresh-ccw'
color: 'green'
Expand Down
3 changes: 2 additions & 1 deletion src/lib/do-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ async function doFetch({

let details = changeStatus.details;
console.log('\n \x1b[1m\x1b[32m'+JSON.stringify(details)+'\x1b[0m\x1b[0m');
core.setOutput("change_number", details.number);

let changeState = details.status;

Expand All @@ -104,4 +105,4 @@ async function doFetch({
return true;
}

module.exports = { doFetch };
module.exports = { doFetch };