Skip to content

Commit dfd3303

Browse files
authored
Merge pull request #89 from evwilkin/chore/3903-weekly-reports
chore: generate weekly reports through GH actions
2 parents d521244 + 1024ef1 commit dfd3303

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Weekly PatternFly Analytics Report
2+
3+
on:
4+
schedule:
5+
# Every Monday at 06:00 UTC
6+
- cron: '0 6 * * 1'
7+
workflow_dispatch:
8+
9+
jobs:
10+
collect-and-report:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 120
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
23+
- name: Setup Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.12'
27+
28+
- name: Install Node dependencies
29+
run: npm install
30+
31+
- name: Install Python dependencies
32+
run: pip install -r requirements.txt
33+
34+
- name: Collect PatternFly stats
35+
run: node src/static-analysis/cli.js collect -j -d
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Generate Excel report
40+
run: python3 to_xls.py
41+
42+
- name: Get report date
43+
id: date
44+
run: echo "date=$(date -u '+%Y-%m-%d')" >> "$GITHUB_OUTPUT"
45+
46+
- name: Setup SSH for uxd-hub.com
47+
if: ${{ env.HAS_SSH_KEY == 'true' }}
48+
env:
49+
HAS_SSH_KEY: ${{ secrets.UXD_HUB_SSH_KEY != '' }}
50+
run: |
51+
mkdir -p ~/.ssh
52+
echo "${{ secrets.UXD_HUB_SSH_KEY }}" > ~/.ssh/id_rsa
53+
chmod 600 ~/.ssh/id_rsa
54+
if [ -n "${{ secrets.UXD_HUB_KNOWN_HOSTS }}" ]; then
55+
echo "${{ secrets.UXD_HUB_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
56+
chmod 644 ~/.ssh/known_hosts
57+
fi
58+
59+
- name: Upload report to uxd-hub.com
60+
if: ${{ env.HAS_SSH_KEY == 'true' }}
61+
env:
62+
HAS_SSH_KEY: ${{ secrets.UXD_HUB_SSH_KEY != '' }}
63+
OPENSSL_CONF: /dev/null
64+
UXD_HUB_USER: ${{ secrets.UXD_HUB_USER }}
65+
run: |
66+
REPORT_DATE="${{ steps.date.outputs.date }}"
67+
USER="${UXD_HUB_USER:-hwr}"
68+
scp -o StrictHostKeyChecking=accept-new \
69+
"reports/${REPORT_DATE}/pf_report.xlsx" \
70+
"${USER}@uxd-hub.com:public_html/images/PF_analytics/${REPORT_DATE}_pf_report.xlsx"
71+
72+
- name: Upload artifacts
73+
uses: actions/upload-artifact@v4
74+
if: always()
75+
with:
76+
name: pf-analytics-${{ steps.date.outputs.date }}
77+
path: |
78+
reports/${{ steps.date.outputs.date }}/pf_report.xlsx
79+
stats-static/${{ steps.date.outputs.date }}/
80+
retention-days: 90

0 commit comments

Comments
 (0)