fix: Fix failure when creating an alert without priority #67
Workflow file for this run
This file contains 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: Tests | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- run: yarn | |
- run: yarn test | |
integration-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- run: yarn | |
- run: yarn compile | |
- name: Set alert values | |
run: | | |
export ALIAS=create-alert-int-test-$(date +%s) | |
export ALL_VALUES_MESSAGE="Alert created with all values" | |
export REQUIRED_VALUES_MESSAGE="Alert created with required values" | |
export DESCRIPTION="alert description" | |
export SOURCE="create alert integration test" | |
echo "ALERT_ALIAS=$(echo -n $ALIAS)" >> $GITHUB_ENV | |
echo "ALL_VALUES_MESSAGE=$(echo -n ALL_VALUES_MESSAGE)" >> $GITHUB_ENV | |
echo "REQUIRED_VALUES_MESSAGE=$(echo -n REQUIRED_VALUES_MESSAGE)" >> $GITHUB_ENV | |
echo "DESCRIPTION=$(echo -n $DESCRIPTION)" >> $GITHUB_ENV | |
echo "SOURCE=$(echo -n $SOURCE)" >> $GITHUB_ENV | |
- name: Create OpsGenie Alert with All Values | |
id: create-alert-all-values | |
uses: ./ | |
with: | |
api_key: ${{ secrets.OPSGENIE_API_KEY }} | |
alias: ${{ env.ALERT_ALIAS }} | |
message: ${{ env.ALL_VALUES_MESSAGE }} | |
description: ${{ env.DESCRIPTION }} | |
source: ${{ env.SOURCE }} | |
priority: P5 | |
tags: kuku | |
using_eu_url: false | |
- name: Assert all values alert created | |
env: | |
OPSGENIE_API_KEY: ${{ secrets.OPSGENIE_API_KEY }} | |
run: | | |
./.github/workflows/assert_alert_created_with.js \ | |
${{ steps.create-alert-all-values.outputs.request_id }} \ | |
"${{ env.ALL_VALUES_MESSAGE }}" \ | |
${{ env.ALERT_ALIAS }} \ | |
"${{ env.DESCRIPTION }}" \ | |
P5 \ | |
kuku \ | |
"${{ env.SOURCE }}" | |
- name: Create OpsGenie Alert with Required Values | |
id: create-alert-required-values | |
uses: ./ | |
with: | |
api_key: ${{ secrets.OPSGENIE_API_KEY }} | |
message: ${{ env.REQUIRED_VALUES_MESSAGE }} | |
- name: Assert required values alert created | |
env: | |
OPSGENIE_API_KEY: ${{ secrets.OPSGENIE_API_KEY }} | |
run: | | |
./.github/workflows/assert_alert_created_with.js \ | |
${{ steps.create-alert-required-values.outputs.request_id }} \ | |
"${{ env.REQUIRED_VALUES_MESSAGE }}" \ | |
"" \ | |
"" \ | |
P5 \ | |
"" \ | |
"" |