File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Count Solved Issues
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 * * * *' # Runs every hour
6+ workflow_dispatch :
7+
8+ jobs :
9+ count :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout
13+ uses : actions/checkout@v3
14+
15+ - name : Count closed issues labeled "Solved"
16+ uses : actions/github-script@v6
17+ with :
18+ script : |
19+ const issues = await github.paginate(github.rest.issues.listForRepo, {
20+ owner: context.repo.owner,
21+ repo: context.repo.repo,
22+ labels: "Solved",
23+ state: "closed",
24+ per_page: 100
25+ });
26+
27+ const count = issues.length;
28+
29+ const fs = require('fs');
30+ const badgeData = {
31+ schemaVersion: 1,
32+ label: "Solved Issues",
33+ message: `${count}`,
34+ color: "4CD66A"
35+ };
36+
37+ fs.writeFileSync("solved-issues-badge.json", JSON.stringify(badgeData));
38+
39+ - name : Commit badge data
40+ run : |
41+ git config user.name "github-actions"
42+ git config user.email "github-actions@github.com"
43+ git add solved-issues-badge.json
44+ git commit -m "Update Solved Issues badge"
45+ git push
You can’t perform that action at this time.
0 commit comments