Skip to content

Report

Report #298

Workflow file for this run

name: Report
on:
schedule:
- cron: "0 8 * * *"
push:
branches:
- main
paths:
- scripts/report.sh
- .github/workflows/report.yml
workflow_dispatch:
jobs:
prepare:
name: Report
permissions:
issues: read
pull-requests: read
packages: read
actions: read
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bash scripts/report.sh >report.txt
- name: Store report
uses: actions/upload-artifact@v3
with:
name: daily_report
path: "report.txt"
- name: Display report
run: |
cat report.txt
echo -n "report_url=" >>${GITHUB_ENV}
curl "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs" \
--silent \
--location \
--fail \
| jq --raw-output '
.jobs[] |
select(.workflow_name == "Report") |
.html_url
' >>${GITHUB_ENV}
- name: Send report
run: |
curl --silent --fail --request POST --data "{\"msgtype\":\"m.text\",\"body\":\"New report available for $(date -d "34 hours ago" +%Y-%m-%d): ${{ env.report_url }}\"}" "https://${{ secrets.MATRIX_SERVER }}/_matrix/client/r0/rooms/${{ secrets.MATRIX_ROOM_ID }}/send/m.room.message?access_token=${{ secrets.MATRIX_ACCESS_TOKEN }}"