|
3 | 3 | push: |
4 | 4 | branches: main |
5 | 5 | jobs: |
6 | | - test: |
7 | | - runs-on: ubuntu-latest |
8 | | - env: |
9 | | - ACTIONS_STEP_DEBUG: true |
10 | | - steps: |
11 | | - - name: Test Change Creation Only |
12 | | - run: | |
13 | | - echo "Testing ServiceNow change creation..." |
14 | | - RESPONSE=$(curl -X POST "https://dev208227.service-now.com/api/sn_devops/v1/devops/orchestration/changeControl" \ |
15 | | - -H "Content-Type: application/json" \ |
16 | | - -H "Accept: application/json" \ |
17 | | - -H "Authorization: sn_devops.DevOpsToken 35432ff783d87210340974b6feaad3bb:${{ secrets.SN_DEVOPS_TOKEN }}" \ |
18 | | - -d '{ |
19 | | - "toolId": "35432ff783d87210340974b6feaad3bb", |
20 | | - "stageName": "test", |
21 | | - "buildNumber": "'${{ github.run_id }}'", |
22 | | - "attemptNumber": "1", |
23 | | - "sha": "'${{ github.sha }}'", |
24 | | - "workflow": "test-minimal", |
25 | | - "repository": "schdief/template", |
26 | | - "branchName": "main", |
27 | | - "changeRequestDetails": {} |
28 | | - }' \ |
29 | | - -w "\nHTTP Status: %{http_code}\n") |
30 | | - |
31 | | - echo "$RESPONSE" |
32 | | - echo "---" |
33 | | - echo "If you see a change number above, creation worked!" |
34 | | - echo "If you see an error, that's why the action is failing!" |
35 | | -
|
36 | 6 | ServiceNowDevOpsChange: |
37 | 7 | runs-on: ubuntu-latest |
38 | 8 | env: |
39 | 9 | ACTIONS_STEP_DEBUG: true |
40 | 10 | steps: |
41 | | - - name: ServiceNowDevOpsChange |
| 11 | + - name: ServiceNow DevOps Change (Basic Auth) |
42 | 12 | uses: ServiceNow/servicenow-devops-change@main |
43 | 13 | id: change_request |
44 | 14 | with: |
45 | | - devops-integration-token: ${{ secrets.SN_DEVOPS_TOKEN }} |
| 15 | + # Use username/password instead of token |
| 16 | + devops-integration-user-name: admin |
| 17 | + devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} |
46 | 18 | instance-url: https://dev208227.service-now.com |
47 | 19 | tool-id: 35432ff783d87210340974b6feaad3bb |
48 | 20 | context-github: ${{ toJSON(github) }} |
49 | | - job-name: 'ServiceNow DevOps Change' |
50 | | - # Use minimal change request - let ServiceNow use defaults |
51 | | - change-request: '{"attributes":{"priority":"2","comments":"Automated deployment from GitHub Actions","short_description":"Deploy from GitHub workflow scaffolder"}}' |
52 | | - timeout: '600' |
53 | | - interval: '30' |
54 | | - |
55 | | - - name: Show Change Request Details |
| 21 | + job-name: 'ServiceNowDevOpsChange' |
| 22 | + change-request: '{}' |
| 23 | + |
| 24 | + - name: Show Results |
56 | 25 | run: | |
57 | | - echo "Change Request Number: ${{ steps.change_request.outputs.change-request-number }}" |
58 | | - echo "Change Request Sys ID: ${{ steps.change_request.outputs.change-request-sys-id }}" |
| 26 | + echo "✅ Change Number: ${{ steps.change_request.outputs.change-request-number }}" |
| 27 | + echo "✅ Change Sys ID: ${{ steps.change_request.outputs.change-request-sys-id }}" |
59 | 28 | deploy: |
60 | 29 | name: 'Deploy' |
61 | 30 | needs: ServiceNowDevOpsChange |
|
0 commit comments