Skip to main content

GitHub Action: datadog-notify

Create Datadog Notify Event

Introduction

This repository contains the action for sending an event to datadog.

Usage

Minimal Usage:

- name: Notify Datadog
uses: cloudposse/github-action-datadog-notify@main
with:
api_key: ## ${{ env.DATADOG_API_KEY }} ## ${{secrets.DATADOG_API_KEY}}
title: "GitHub Action: ${{ github.event_name }}"
text: "GitHub Action: ${{ github.event_name }}"
tags: "source:github,repo:${{ github.repository }},event:${{ github.event_name }}"
alert_type: "info"

Below is a snippet that will send an event to datadog when a pull request is sync'd. Below uses the dkershner6/aws-ssm-getparameters-action to get the datadog api key from ssm.

name: Datadog Notify
on:
workflow_dispatch:
pull_request:
branches:
- 'main'

permissions:
contents: read
pull-requests: write
id-token: write

jobs:
datadog-notify:
runs-on: ["self-hosted"]
steps:
- uses: actions/checkout@v3

- name: Configure AWS credentials
id: aws-credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: "gha-datadog-notify"
aws-region: "us-east-1"

- uses: dkershner6/aws-ssm-getparameters-action@v1
with:
parameterPairs: "/datadog/datadog_api_key = DATADOG_API_KEY"

- name: Notify Datadog
uses: cloudposse/github-action-datadog-notify@main
with:
api_key: ${{ env.DATADOG_API_KEY }}
title: "GitHub Action: ${{ github.event_name }}"
text: "GitHub Action: ${{ github.event_name }}"
tags: "source:github,repo:${{ github.repository }},event:${{ github.event_name }}"
alert_type: "info"

Inputs

NameDescriptionDefaultRequired
alert_typeType of the event, one of: error,warning,info,success,user_update,recommendation,snapshotinfotrue
api_keyDatadog API KeyN/Atrue
append_hostname_tagShould we append the hostname as a tag to the event, set this to the key of the tagfalse
tagsSpace separated list of Tags for the eventN/Atrue
textDescription of the eventN/Atrue
titleTitle of the eventN/Atrue

Outputs

NameDescription