Skip to main content

Creating Your Own Customized GitHub Status Check


  • Harness CI


  • Infrastructure: Any
  • OS: Any


Before you begin, make sure you are familiar with the following concepts and have the necessary resources:

  • Harness CI Basics: Familiarize yourself with the basics of Harness CI.
  • CI Run Step: Understand how to configure a CI Run Step in your pipeline.
  • GitHub Personal Access Token: Generate a personal access token in your GitHub account, which will be used for authentication.
  • Pipeline: Have an existing pipeline in Harness where you want to add the GitHub Status Check.

Create a secret to store your GitHub Personal Access Token

To ensure the security of your personal access token, we recommend storing it in a safe place like the Harness Secret Manager. Follow these steps to create a secret and store your GitHub Personal Access Token:

  1. Generate a personal access token in your GitHub account.
  2. Navigate to the Secret Manager and create a new secret. Add and reference text secrets.
  3. Add the GitHub Personal Access Token as the value for the secret.

Add a Run Step to your CI Stage

Once you have the secret set up, you can add a Run Step to your pipeline to implement the GitHub Status Check. Here's how you can configure the step parameters:

  1. Click on the Add Step button and select Run Step from the options. Remember, it must be inside of a CI Stage
  2. Configure the step parameters:
    • Name: Provide a descriptive name for the step (e.g., "GitHub Status Check - Pending").
    • Container Registry: Choose the appropriate container registry (e.g., Harness Docker Connector).
    • Image: Select an image that has cURL installed. You can use the official image from DockerHub curlimages/curl
    • Shell: Set it to "sh" for running shell commands.

Customize the script

In this step, you will include a script to send a request to GitHub's API. Follow these instructions:

  1. Copy and paste the following command into the Run Step configuration, and make the necessary edits based on your requirements:
  curl -i \
-H "Authorization: Bearer <+secrets.getValue('account.Github_Access_Token')>" \
-H "Accept: application/vnd.github.v3+json" \<YOUR_ORGANIZATION>/<>/statuses/<+codebase.commitSha> \
-d '{"state":"pending","target_url":"<+pipeline.execution.url>","description":"Test is running","context":"harness-ci/tests"}'
  1. Replace the <+secrets.getValue('account.Github_Access_Token')> placeholder with the secret reference that contains your GitHub Personal Access Token.

  2. Customize the remaining placeholders based on your repository and pipeline details.


The example above provides the fundamental command to create a GitHub Status Check, but it may not cover all your requirements. Feel free to leverage our expressions and tailor the script according to your specific needs.