Skip to content

Commit

Permalink
chore: update star notification action
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Aug 25, 2024
1 parent 6b7b31e commit dc91b02
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/star-fork-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Get repository information
run: |
result=$(curl -s -H "Authorization: token ${{ secrets.READ_REPO_STAR_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}")
result=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}")
stars=$(echo $result | jq '.stargazers_count')
forks=$(echo $result | jq '.forks_count')
repo_name=$(echo $result | jq -r '.name')
Expand All @@ -37,16 +37,16 @@ jobs:
- name: Get repo download count
run: |
download_count=$(curl -s -H "Authorization: token ${{ secrets.READ_REPO_STAR_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases" | jq '.[].assets[].download_count' | awk '{sum += $1} END {print sum}')
download_count=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases" | jq '.[].assets[].download_count' | awk '{sum += $1} END {print sum}')
echo "Number of downloads: $download_count"
echo "download_count=$download_count" >> $GITHUB_ENV
- name: Get user information
id: check_conditions
run: |
earn_star_count=$(curl -s -H "Authorization: token ${{ secrets.READ_REPO_STAR_TOKEN }}" "https://api.github.com/users/${{ github.actor }}/repos" | jq '[.[] | .stargazers_count] | add // 0')
commit_count=$(curl -s -H "Authorization: token ${{ secrets.READ_REPO_STAR_TOKEN }}" "https://api.github.com/search/commits?q=author:${{ github.actor }}" | jq -r '.total_count // 0')
follower_count=$(curl -s -H "Authorization: token ${{ secrets.READ_REPO_STAR_TOKEN }}" "https://api.github.com/users/${{ github.actor }}" | jq '.followers // 0')
earn_star_count=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/users/${{ github.actor }}/repos?per_page=100&sort=pushed" | jq '[.[] | .stargazers_count] | add // 0')
commit_count=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/search/commits?per_page=100&q=author:${{ github.actor }}" | jq -r '.total_count // 0')
follower_count=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/users/${{ github.actor }}" | jq '.followers // 0')
echo "Star count: $earn_star_count"
echo "Commit count: $commit_count"
Expand Down Expand Up @@ -87,6 +87,7 @@ jobs:
username: ${{ secrets.GMAIL_BOT_USERNAME }}
password: ${{ secrets.GMAIL_BOT_PASSWORD }}
subject: ${{ github.actor }} ${{ env.event_name }} ${{ env.repo_name }}
# List stargazers https://github.com/tisfeng/Easydict/stargazers
html_body: ${{ env.html_body }}
to: ${{ secrets.RECEIVER_EMAIL }}
from: GitHub Actions

0 comments on commit dc91b02

Please sign in to comment.