Skip to content

Commit c1d61e8

Browse files
committed
prints result
1 parent 327a8cc commit c1d61e8

File tree

1 file changed

+13
-33
lines changed

1 file changed

+13
-33
lines changed
Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Weekly Clone Stats Email
22

33
on:
4-
# Every Monday at 08:00 UTC
54
schedule:
6-
- cron: '0 8 * * 1'
5+
- cron: '0 8 * * 1' # Every Monday at 08:00 UTC
76

87
pull_request:
98
branches:
@@ -19,6 +18,9 @@ jobs:
1918
- name: Check out code
2019
uses: actions/checkout@v3
2120

21+
- name: Install jq
22+
run: sudo apt-get update && sudo apt-get install -y jq
23+
2224
- name: Fetch Clone Stats
2325
env:
2426
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -28,53 +30,31 @@ jobs:
2830
"https://api.github.com/repos/$REPO/traffic/clones" > clone_stats.json
2931
3032
- name: Upload Clone Stats
31-
uses: actions/upload-artifact@v4
33+
uses: actions/upload-artifact@v3
3234
with:
33-
# This is the name used to identify the artifact
3435
name: clone-stats
35-
# File(s) or directories you want to upload as the artifact
3636
path: clone_stats.json
3737

38-
send-email:
38+
print-stats:
3939
needs: fetch-clone-stats
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: Check out code
4343
uses: actions/checkout@v3
4444

4545
- name: Download Clone Stats
46-
uses: actions/download-artifact@v4
46+
uses: actions/download-artifact@v3
4747
with:
48-
# Must match the name used above in actions/upload-artifact
4948
name: clone-stats
50-
# The path/folder where the artifact is extracted
5149
path: .
5250

53-
- name: Parse clone stats
51+
- name: Print raw JSON
52+
run: cat clone_stats.json
53+
54+
- name: Parse and Print Stats
5455
id: parse
5556
run: |
5657
COUNT=$(jq '.count' clone_stats.json)
5758
UNIQUES=$(jq '.uniques' clone_stats.json)
58-
echo "count=$COUNT" >> $GITHUB_OUTPUT
59-
echo "uniques=$UNIQUES" >> $GITHUB_OUTPUT
60-
61-
- name: Send email
62-
uses: dawidd6/action-send-mail@v3
63-
with:
64-
server_address: smtp.sendgrid.net
65-
server_port: 587
66-
secure: true
67-
username: ${{ secrets.SMTP_USERNAME }}
68-
password: ${{ secrets.SMTP_PASSWORD }}
69-
from: ${{ vars.EMAIL_FROM }}
70-
to: ${{ vars.EMAIL_TO }}
71-
subject: "📊 Weekly GitHub Clone Stats for ${{ github.repository }}"
72-
body: |
73-
Hi,
74-
75-
Here are the clone stats for *${{ github.repository }}* this week:
76-
77-
🔁 Total Clones: ${{ steps.parse.outputs.count }}
78-
👤 Unique Cloners: ${{ steps.parse.outputs.uniques }}
79-
80-
– GitHub Bot
59+
echo "Total Clones: $COUNT"
60+
echo "Unique Cloners: $UNIQUES"

0 commit comments

Comments
 (0)