forked from connect-boiz/soroban-security-scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (125 loc) · 4.52 KB
/
Copy pathCONTRIBUTOR_REWARDS.yml
File metadata and controls
147 lines (125 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Contributor Rewards System
on:
pull_request:
types: [closed]
branches: [main]
issues:
types: [closed]
schedule:
# Run monthly reward calculations
- cron: '0 0 1 * *'
jobs:
calculate-contributions:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: |
npm install -g @octokit/rest
npm install axios
- name: Calculate PR Contributions
if: github.event_name == 'pull_request'
run: |
node .github/scripts/calculate-pr-rewards.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
CONTRIBUTOR: ${{ github.event.pull_request.user.login }}
- name: Calculate Monthly Rewards
if: github.event_name == 'schedule'
run: |
node .github/scripts/calculate-monthly-rewards.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRIPS_API_KEY: ${{ secrets.DRIPS_API_KEY }}
update-contributor-stats:
runs-on: ubuntu-latest
needs: calculate-contributions
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update contributor statistics
run: |
# Update contributor stats file
echo "Updating stats for ${{ github.event.pull_request.user.login }}"
- name: Commit updated stats
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .github/contributors.json
git commit -m "Update contributor stats for ${{ github.event.pull_request.user.login }}" || exit 0
git push
notify-drips-network:
runs-on: ubuntu-latest
needs: calculate-contributions
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
steps:
- name: Notify Drips Network
run: |
curl -X POST "https://api.drips.network/v1/rewards" \
-H "Authorization: Bearer ${{ secrets.DRIPS_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{
"contributor": "${{ github.event.pull_request.user.login }}",
"repository": "stellar-security-scanner",
"pull_request": "${{ github.event.pull_request.number }}",
"reward_amount": "${{ steps.calculate.outputs.reward_amount }}",
"contribution_type": "${{ steps.calculate.outputs.contribution_type }}"
}'
issue-rewards:
runs-on: ubuntu-latest
if: github.event_name == 'issues' && github.event.issue.state == 'closed'
steps:
- name: Calculate issue rewards
run: |
# Calculate rewards for issue resolution
node .github/scripts/calculate-issue-rewards.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
monthly-report:
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
steps:
- name: Generate monthly report
run: |
node .github/scripts/generate-monthly-report.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create monthly report issue
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('monthly-report.md', 'utf8');
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `📊 Monthly Contribution Report - ${new Date().toISOString().slice(0, 7)}`,
body: report,
labels: ['monthly-report', 'community']
});
badge-assignments:
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
steps:
- name: Assign contributor badges
run: |
node .github/scripts/assign-badges.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update README with top contributors
run: |
node .github/scripts/update-readme.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}