Use the GitHub Deployment Gate capability to decide on whether a new deployment should proceed or halt.

Before you begin

GitHub deployment gates are supported only if you have connected your GitHub instance with Oauth 2.0 credentials for GitHub Apps using the JWT bearer token. For more information, see OAuth 2.0 credentials for GitHub Apps - JWT.

By default, the Deployment protection rules section is available for environments in all the repositories selected in the installed GitHub App.

Role required: Permission to create environments in GitHub

Procedure

  1. Navigate to Settings > Environments from a repository and click New environment to create an environment. Add new environment for GitHub App
  2. In the Deployment protection rules section, select the installed GitHub App name, and select Save protection rules. Configure deployment gate in GitHub App environment
  3. Add the ServiceNow DevOps Change Automation custom action at the step level (for example, changeRequest job in workflow/yaml file) in a pipeline job to create the change for deployment gates.
    The deployment-gate parameter must be added in the following JSON format.
    '{"environment":"deployment_gate","jobName":"Deploy"}'
    Here environment key value is the environment created with deployment protection rules, and jobName key value is the deployment job created in the workflow/yaml file with dependency on the change request job configured with the ServiceNow DevOps Change Automation custom action. Deployment gate parameter

    When the deployment gate specific workflow/yaml file is run in GitHub Actions, the details like change number, change url, and status will be displayed once the change request is created in ServiceNow. Change details for deployment gate

    The details like change comments, approved by, approved on, and status are logged in the GitHub tool after the workflow run is resumed from ServiceNow, i.e. when change request is approved and the change request state is updated to Implement in ServiceNow. Change logs for deployment gate