GitHub Actions Integration

Integrate ServiceNow with GitHub Actions workflows for automated change management and compliance

Overview

This guide demonstrates how to integrate ServiceNow change management with GitHub Actions workflows. The integration enables automated change request creation, approval gates, and deployment tracking directly from GitHub Actions.

Integration Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       GitHub Actions Workflow              β”‚
β”‚                                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚Build │─→│ Test │─→│ Create SNOW   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜  β”‚ Change Requestβ”‚   β”‚
β”‚                       β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                               β”‚           β”‚
β”‚                               β–Ό           β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚                    β”‚ Wait for Approval  β”‚ β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                               β”‚           β”‚
β”‚                               β–Ό           β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚                    β”‚ Deploy Application β”‚ β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                               β”‚           β”‚
β”‚                               β–Ό           β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚                    β”‚ Close Change       β”‚ β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚
                        β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚   ServiceNow     β”‚
              β”‚  Change Request  β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Prerequisites

ServiceNow Setup

  1. API Access: ServiceNow instance with REST API enabled

  2. Service Account: User with itil role for change management

  3. OAuth Configuration (recommended for production)

GitHub Setup

  1. Repository Secrets (Settings > Secrets and variables > Actions):

  2. Repository Variables (optional):

Method 1: Direct REST API Integration

Basic Workflow

Create .github/workflows/deploy-with-servicenow.yml:

Method 2: Reusable Composite Actions

Create Custom Action

Create .github/actions/servicenow-change/action.yml:

Use Custom Action

Method 3: Python Script with GitHub Actions

Python Script Approach

Create .github/scripts/servicenow.py (see GitLab integration for full script)

Standard Changes for Faster Deployment

Pre-Approved Standard Change

Matrix Strategy for Multiple Environments

Emergency Change Workflow

Best Practices

Use Environment Protection Rules

Combine ServiceNow with GitHub environment protection:

Add Deployment Evidence

Handle Rollbacks

Troubleshooting

Debug API Calls

Common Issues

Issue
Solution

401 Unauthorized

Verify secrets are correctly set

Timeout waiting for approval

Check ServiceNow approval workflow, increase timeout

jq command not found

Use ubuntu-latest runner (includes jq)

Change not found

Verify sys_id is passed between jobs via outputs

Next Steps

Additional Resources

Last updated