Statistic Member Reward #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Statistic Member Reward | |
on: | |
schedule: | |
- cron: "0 0 1 * *" # Run at 00:00 on the first day of every month | |
env: | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
statistic-member-reward: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Check for new commits since last statistic | |
run: | | |
last_tag=$(git describe --tags --abbrev=0 --match "statistic-*" || echo "") | |
if [ -z "$last_tag" ]; then | |
echo "No previous statistic tags found." | |
echo "NEW_COMMITS=true" >> $GITHUB_ENV | |
else | |
new_commits=$(git log $last_tag..HEAD --oneline) | |
if [ -z "$new_commits" ]; then | |
echo "No new commits since last statistic tag." | |
echo "NEW_COMMITS=false" >> $GITHUB_ENV | |
else | |
echo "New commits found." | |
echo "NEW_COMMITS=true" >> $GITHUB_ENV | |
fi | |
fi | |
- uses: denoland/setup-deno@v2 | |
if: env.NEW_COMMITS == 'true' | |
with: | |
deno-version: v2.x | |
- name: Statistic rewards | |
if: env.NEW_COMMITS == 'true' | |
run: deno --allow-all .github/scripts/count-reward.ts |