Skip to content

Added labels instead of protoPayloads #199

Added labels instead of protoPayloads

Added labels instead of protoPayloads #199

name: Validate alert templates and metadata
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "master" ]
paths: ["alerts/**"]
pull_request:
branches: [ "master" ]
paths: ["alerts/**"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v25
- name: checkout repo content
uses: actions/checkout@v2 # checkout the repository content to github runner.
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8 #install the python needed
- name: Install dependencies
run: |
pip3 install pyyaml
pip install --upgrade google-cloud-monitoring
- name: execute py script # run file
run: |
for file in ${{ steps.changed-files.outputs.added_files }}; do
echo "$file was added"
if echo $file | grep -q "alerts"; then
echo "running scripts/alerts/validate_alerts_format on $file"
python3 scripts/alerts/validate_alerts_format.py $file
fi
done