-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.43 KB
/
download-alerts.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Download upstream alerts
on:
schedule:
- cron: '0 10 * * 1-5'
workflow_dispatch: {}
env:
COMPONENT_NAME: openshift4-logging
jobs:
alerts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '>=1.19.0'
- name: Download upstream alerts
run: make extract-alerts
- name: Commit changes to repository
run: |
set -e
if [[ -z $(git status --porcelain "${ALERTS_DIR}") ]]; then
echo "No changes to commit"
exit 0
fi
make gen-golden-all
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git switch -c "${ALERTS_UPDATES_BRANCH}"
git add "${ALERTS_DIR}" tests/golden
git commit -m "Update upstream alerts"
git push -u -f origin "${ALERTS_UPDATES_BRANCH}"
# Check if there is an existing PR that is OPEN or create a new one
gh pr view --json 'state' -q '.state == "OPEN" or halt_error(1)' || gh pr create --title "Update upstream alerts" --body "This PR updates the upstream alerts defined in alerts.txt." --label dependency
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ALERTS_DIR: component/extracted_alerts
ALERTS_UPDATES_BRANCH: dependencies/update-upstream-alerts