forked from konflux-ci/qe-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.2 KB
/
slack-message.yml
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
45
46
name: Prow-CI
on:
schedule:
- cron: '30 3 * * *' # Runs every day at 3:30 AM UTC (9 AM IST)
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:1.22
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Fetch URL Content
run: |
latest=$(curl -s ${{ secrets.URL }})
echo "LATEST=$latest" >> $GITHUB_ENV
- name: Run Test and Store Output
run: |
go run main.go prowjob periodic-report > prowjob-output.txt
echo $PROW_URL
env:
PROW_URL: ${{ secrets.PROW_URL }}${{ env.LATEST }}
- name: Conditional Slack Message
run: |
output=$(cat prowjob-output.txt)
if [ "$output" != "Job Succeeded" ]; then
echo "Job Failed, sending Slack message."
go run main.go send-slack-message -m "$output"
else
echo "Job Succeeded, not sending Slack message."
fi
env:
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}