Skip to content

Commit 11c06db

Browse files
committed
Automated
1 parent 5e25da1 commit 11c06db

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Weekly Clone Stats Email
2+
3+
on:
4+
schedule:
5+
- cron: "0 8 * * 1" # Every Monday at 08:00 UTC
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
fetch-clone-stats:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v3
16+
17+
- name: Fetch Clone Stats
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
20+
run: |
21+
REPO="${{ github.repository }}"
22+
curl -L \
23+
-H "Accept: application/vnd.github+json" \
24+
-H "Authorization: Bearer $GITHUB_TOKEN" \
25+
-H "X-GitHub-Api-Version: 2022-11-28" \
26+
https://api.github.com/repos/$REPO/traffic/clones > clone_stats.json
27+
28+
- name: Upload Clone Stats
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: clone-stats
32+
path: clone_stats.json
33+
34+
downloading-and-sending-stats:
35+
needs: fetch-clone-stats
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Check out code
39+
uses: actions/checkout@v3
40+
41+
- name: Download Clone Stats
42+
uses: actions/download-artifact@v4
43+
with:
44+
name: clone-stats
45+
path: .
46+
47+
- name: Parse clone stats
48+
id: parse
49+
run: |
50+
COUNT=$(jq '.count' clone_stats.json)
51+
UNIQUES=$(jq '.uniques' clone_stats.json)
52+
echo "count=$COUNT" >> "$GITHUB_OUTPUT"
53+
echo "uniques=$UNIQUES" >> "$GITHUB_OUTPUT"
54+
55+
- name: Send custom email
56+
run: |
57+
ENCODED_AUTH=${{ secrets.SENDGRID_KEY }}
58+
FROM=${{ vars.EMAIL_FROM }}
59+
TO=${{ vars.EMAIL_TO }}
60+
COUNT=${{ steps.parse.outputs.count }}
61+
REPOSITORY=${{ github.repository }}
62+
UNIQUES=${{ steps.parse.outputs.uniques }}
63+
64+
curl -X POST https://api.sendgrid.com/v3/mail/send \
65+
-H "Authorization: Bearer $ENCODED_AUTH" \
66+
-H "Content-Type: application/json" \
67+
-d "{
68+
\"personalizations\": [{
69+
\"to\": [{\"email\": \"${TO}\"}],
70+
\"subject\": \"Weekly GitHub Clone Stats for ${REPOSITORY}\"
71+
}],
72+
\"from\": {\"email\": \"${FROM}\"},
73+
\"content\": [{
74+
\"type\": \"text/plain\",
75+
\"value\": \"Hi there! Here are the clone stats for ${REPOSITORY} this week:\n\n🔁 Total Clones: ${COUNT}\n👤 Unique Cloners: ${UNIQUES}\"
76+
}]
77+
}"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ You still have full control over the UI though.
219219
Most importantly we also render these screens in the right order for you so you don't need to bother
220220
with complex routing during authentication.
221221

222+
## Telemetry
223+
224+
This example application utilizes telemetry events to gain deeper insights into its usage and the SDK's utilization. Such information is instrumental in guiding our prioritization of features that will be most beneficial and impactful for the majority of our users. Read our [official documentation](https://docs.corbado.com/corbado-complete/other/telemetry) for more details.
225+
222226
## Troubleshooting
223227

224228
| Type | Issue | Note |

0 commit comments

Comments
 (0)