-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (63 loc) · 2.79 KB
/
Copy pathcron_daily_umami_report.yml
File metadata and controls
71 lines (63 loc) · 2.79 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: daily-umami-report
permissions:
contents: none
on:
schedule:
- cron: '30 17 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
umamiReportJob:
name: daily umami report
runs-on: ubuntu-latest
env:
UMAMI_LOGO: https://raw.githubusercontent.com/umami-software/website/refs/heads/master/public/images/umami-logo.png
outputs:
umami_page_views: ${{ steps.umamiReportStep.outputs.pageViews }}
umami_report_file: ${{ steps.umamiReportStep.outputs.umamiReportFile }}
# umami_report: ${{ steps.umamiReport.outputs.umamiReport }}
# umami_one_line_report: ${{ steps.umamiReport.outputs.umamiOneLineReport }}
steps:
- name: Create Daily Umami report
id: umamiReportStep
uses: boly38/action-umami-report@umami-server-2.17.0
with:
umami-server: ${{secrets.UMAMI_SERVER}}
umami-user: ${{secrets.UMAMI_USERNAME}}
umami-password: ${{secrets.UMAMI_PASSWORD}}
umami-site-domain: ${{secrets.UMAMI_SITE_DOMAIN}}
umami-report-file: 'umamiReport.txt'
env:
UMAMI_CLIENT_TIMEOUT_MS: 5000
- name: Assume umamiReportFile exists and pageViews != 0
run: |
if [[ -z "${{ steps.umamiReportStep.outputs.umamiReportFile }}" ]]; then
echo "::error title=no umamiReportFile::❌ Error : no umamiReportFile"
exit 1
fi
if [[ "${{ steps.umamiReportStep.outputs.pageViews }}" == "0" ]]; then
echo "::notice title=no pageViews::ℹ️ pageViews=0 😞"
exit 0
fi
echo "::notice title=OneLineReport::ℹ️ ${{ steps.umamiReportStep.outputs.umamiOneLineReport }}"
- name: Send Umami Host report to discord if pageViews is positive
if: steps.umamiReportStep.outputs.pageViews != '0'
uses: tsickert/discord-webhook@v7.0.0
with:
webhook-url: ${{ secrets.UMAMI_TO_DISCORD_WEBHOOK_URL }}
username: "Umami report"
avatar-url: ${{ env.UMAMI_LOGO }}
content: "${{ steps.umamiReportStep.outputs.umamiOneLineReport }}"
filename: "${{ steps.umamiReportStep.outputs.umamiReportFile }}"
- name: Have a look at !secret results from next step using outputs
run: |
echo "${{ steps.umamiReportStep.outputs.umamiReportFile }}"
ls -la "${{ steps.umamiReportStep.outputs.umamiReportFile }}"
nextJob:
needs: umamiReportJob
name: github action next job
runs-on: ubuntu-latest
steps:
- name: print var
run: |
echo "FROM umamiReport outputs: ${{ needs.umamiReportJob.outputs.umami_report_file }} and ${{ needs.umamiReportJob.outputs.umami_page_views }} pageviews "