Update scaffolder.yaml #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: scaffolder | ||
| on: | ||
| push: | ||
| branches: main | ||
| jobs: | ||
| ServiceNowDevOpsChange: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| ACTIONS_STEP_DEBUG: true | ||
| ACTIONS_RUNNER_DEBUG: true | ||
| steps: | ||
| - name: Debug Input Values | ||
| run: | | ||
| echo "::debug::Instance URL: https://dev208227.service-now.com" | ||
| echo "::debug::Tool ID: 35432ff783d87210340974b6feaad3bb" | ||
| echo "::debug::Job Name: ServiceNow DevOps Change" | ||
| echo "::debug::GitHub Context Keys: ${{ join(keys(github), ', ') }}" | ||
| echo "::debug::GitHub Repository: ${{ github.repository }}" | ||
| echo "::debug::GitHub Event: ${{ github.event_name }}" | ||
| shell: bash | ||
| - name: ServiceNow DevOps Change | ||
| uses: ServiceNow/servicenow-devops-change@main | ||
| id: change_request | ||
| continue-on-error: true # Continue even if this step fails | ||
| with: | ||
| devops-integration-token: ${{ secrets.SN_DEVOPS_TOKEN }} | ||
| instance-url: https://dev208227.service-now.com | ||
| tool-id: 35432ff783d87210340974b6feaad3bb | ||
| context-github: ${{ toJSON(github) }} | ||
| job-name: 'ServiceNow DevOps Change' | ||
| change-request: '{"attributes":{"requested_by":{"name": "Test User"},"assignment_group":{"name": "Change Approval Team"},"priority": "2","comments": "This is a sample pipeline script to be added in your change step","work_notes": "Update this to work_notes","start_date": "2025-10-08 11:59:59","end_date": "2025-10-09 11:59:59"}}' | ||
| deployment-gate: '{"environment": "deploy-gates-demo", "jobName": "Deploy"}' | ||
| # Add shorter timeouts for faster debugging | ||
| timeout: '300' # 5 minutes instead of default 1 hour | ||
| interval: '30' # 30 seconds instead of default 100 | ||
| changeCreationTimeOut: '180' # 3 minutes instead of default 1 hour | ||
| - name: Debug ServiceNow Action Results | ||
| run: | | ||
| echo "Step outcome: ${{ steps.change_request.outcome }}" | ||
| echo "Step conclusion: ${{ steps.change_request.conclusion }}" | ||
| echo "Change Request Number: '${{ steps.change_request.outputs.change-request-number }}'" | ||
| echo "Change Request Sys ID: '${{ steps.change_request.outputs.change-request-sys-id }}'" | ||
| # Check if outputs are empty | ||
| if [ -z "${{ steps.change_request.outputs.change-request-number }}" ]; then | ||
| echo "::warning::Change request number is empty" | ||
| fi | ||
| if [ -z "${{ steps.change_request.outputs.change-request-sys-id }}" ]; then | ||
| echo "::warning::Change request sys ID is empty" | ||
| fi | ||
| shell: bash | ||
| - name: Test ServiceNow Instance Connectivity | ||
| if: failure() || steps.change_request.outcome == 'failure' | ||
| run: | | ||
| echo "Testing connectivity to ServiceNow instance..." | ||
| curl -I https://dev208227.service-now.com || echo "Failed to connect to ServiceNow instance" | ||
| shell: bash | ||
| - name: Validate Token (if possible) | ||
| if: failure() || steps.change_request.outcome == 'failure' | ||
| run: | | ||
| if [ -n "${{ secrets.SN_DEVOPS_TOKEN }}" ]; then | ||
| echo "DevOps integration token is provided" | ||
| echo "Token length: ${#SN_DEVOPS_TOKEN}" | ||
| else | ||
| echo "::error::DevOps integration token is missing!" | ||
| fi | ||
| env: | ||
| SN_DEVOPS_TOKEN: ${{ secrets.SN_DEVOPS_TOKEN }} | ||
| shell: bash | ||
| deploy: | ||
| name: 'Deploy' | ||
| needs: ServiceNowDevOpsChange | ||
| runs-on: ubuntu-latest | ||
| environment: deploy-gates-demo | ||
| steps: | ||
| - name: Run deployment scripts | ||
| run: echo Completed Deployment | ||