Skip to content

Commit

Permalink
feat: improvement to the script to limit at time
Browse files Browse the repository at this point in the history
akorchyn committed Sep 19, 2024

Verified

This commit was signed with the committer’s verified signature.
akorchyn Artur Yurii Korchynskyi
1 parent 58dc38f commit 17addc8
Showing 6 changed files with 433 additions and 226 deletions.
55 changes: 43 additions & 12 deletions issue_creator/issue_content.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
# RoStober - Join gamifying hackathon for the RoStober event
🏁 RoSctober 2024: The Open Source Developer Challenge is about to start! 🎉

Hey, we are Race-of-Sloths and we are asking if you would be interested to participate in a RoStober event.
As part of the RoSctober Race presented by [Race of Sloths](https://race-of-sloths.com/), we recognized this repo to be highly valuable in the open-source movement, and we want to encourage developers to contribute to it.

What is RoStober?
The RoSctober Race contributions will be rewarded proportionally to their contributions to the selected open-source projects. Read below for the official rules, and let’s see who will climb to the top of the Sloth Hall of Fame! 🦥

- lorem ipsum dolor sit amet
- lorem ipsum dolor sit amet
- lorem ipsum dolor sit amet
- lorem ipsum dolor sit amet
- lorem ipsum dolor sit amet
- lorem ipsum dolor sit amet
- lorem ipsum dolor sit amet
- lorem ipsum dolor sit amet
- lorem ipsum dolor sit amet
## TLDR for maintainers:

- This issue is an invitation to join [Race of Sloths](https://race-of-sloths.com/) project
- To accept the invitation, comment `@race-of-sloths accept`
- Once the invitation is accepted, your contributors are eligible to participate in the RoSctober Race with a $10,000 prize pool

## What is the RoSctober Race and Race of Sloths?
RoSctober Race was inspired by Hacktoberfest and is the first thematic Race of [Race of Sloths](https://race-of-sloths.com/) project. Our goal is to make the open-source contributions more fun and rewarding, allowing developers to contribute, get recognized, participate in weekly and monthly quests, and boost their profiles by earning points and competing in the leaderboards - all in a non-intrusive way with just a couple of commands directly in GitHub interface.

1. Every contributor is welcome
2. Prize Pool: $10,000 USDT 💰
3. Eligibility: Earn at least 100 SP during RoSctober to qualify for the prize.
4. Competition Timeline: October 1st to October 31st, 2024
5. Submission Process: Tag @race-of-sloths in any comment on GitHub to automatically submit your PR.
6. Scoring system: Tag @race-of-sloths score [1/2/3/5/8/13] (for maintainers only!). Detailed info here: [Sloth Points System](https://race-of-sloths.com/faq).




<details><summary>More information </summary>
<p>

- [Full rule set](https://github.com/NEAR-DevHub/race-of-sloths/wiki/RoSctober-Official-Rules)
- [Race of Sloths project](https://race-of-sloths.com/)
- [X](https://x.com/race_of_sloths)
- [Telegram community](https://t.me/race_of_sloths)

<details>
<summary><strong>Bot commands</strong></summary>

-**Include a PR:** `@race-of-sloths include` to enter the Race with your PR
- 👋 **Invite a PR author:** `@race-of-sloths invite` to invite the author who haven't tagged the bot in the Race
- 🛑 **Reject this PR:** `@race-of-sloths exclude` to send the PR back to the drawing board.
-**Assign points:** `@race-of-sloths score [1/2/3/5/8/13]` to award points based on your assessment.
- 🔕 **Pause us:** `@race-of-sloths pause` to stop the bot on your repo.
</details>


</p>
</details>
551 changes: 352 additions & 199 deletions issue_creator/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions issue_creator/package.json
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
"dependencies": {
"@octokit/rest": "^19.0.7",
"cli-progress": "^3.12.0",
"lodash": "^4.17.21",
"yargs": "^17.7.2"
},
"devDependencies": {
21 changes: 21 additions & 0 deletions issue_creator/progress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"https://github.com/alexcrichton/tar-rs": "https://github.com/alexcrichton/tar-rs/issues/378",
"https://github.com/PeculiarVentures/PKI.js": "https://github.com/PeculiarVentures/PKI.js/issues/420",
"https://github.com/nodejs/undici": "https://github.com/nodejs/undici/issues/3623",
"https://github.com/JelteF/derive_more": "https://github.com/JelteF/derive_more/issues/412",
"https://github.com/tokio-rs/axum": "https://github.com/tokio-rs/axum/issues/2915",
"https://github.com/SBoudrias/Inquirer.js": "https://github.com/SBoudrias/Inquirer.js/issues/1560",
"https://github.com/conventional-changelog/conventional-changelog": "https://github.com/conventional-changelog/conventional-changelog/issues/1302",
"https://github.com/follow-redirects/follow-redirects": "https://github.com/follow-redirects/follow-redirects/issues/269",
"https://github.com/fitzgen/is_executable": "https://github.com/fitzgen/is_executable/issues/15",
"https://github.com/serde-rs/serde": "https://github.com/serde-rs/serde/issues/2825",
"https://github.com/mgeisler/textwrap": "https://github.com/mgeisler/textwrap/issues/558",
"https://github.com/unjs/get-port-please": "https://github.com/unjs/get-port-please/issues/99",
"https://github.com/rustls/webpki-roots": "https://github.com/rustls/webpki-roots/issues/81",
"https://github.com/crossbeam-rs/crossbeam": "https://github.com/crossbeam-rs/crossbeam/issues/1136",
"https://github.com/nix-rust/nix": "https://github.com/nix-rust/nix/issues/2508",
"https://github.com/scroll-into-view/scroll-into-view-if-needed": "https://github.com/scroll-into-view/scroll-into-view-if-needed/issues/1204",
"https://github.com/react-component/dialog": "https://github.com/react-component/dialog/issues/460",
"https://github.com/expressjs/express": "https://github.com/expressjs/express/issues/5973",
"https://github.com/npm/proc-log": "https://github.com/npm/proc-log/issues/103"
}
14 changes: 1 addition & 13 deletions issue_creator/repositories_to_send.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
"https://github.com/BLAKE3-team/BLAKE3",
"https://github.com/RustCrypto/hashes",
"https://github.com/RustCrypto/utils",
"https://github.com/near/borsh-rs",
"https://github.com/camshaft/bolero",
"https://github.com/rust-lang/cargo",
"https://github.com/supranational/blst",
@@ -62,7 +61,6 @@
"https://github.com/rust-lang/libz-sys",
"https://github.com/nix-rust/nix",
"https://github.com/sunfishcode/linux-raw-sys",
"https://github.com/near/nearcore",
"https://github.com/rust-bakery/nom",
"https://github.com/rusqlite/rusqlite",
"https://github.com/rust-rocksdb/rust-rocksdb",
@@ -127,23 +125,19 @@
"https://github.com/paupino/rust-decimal",
"https://github.com/taiki-e/portable-atomic",
"https://github.com/jam1garner/owo-colors",
"https://github.com/near/near-cli-rs",
"https://github.com/rustls/rustls",
"https://github.com/mgeisler/smawk",
"https://github.com/rustls/webpki",
"https://github.com/mgeisler/textwrap",
"https://github.com/GREsau/schemars",
"https://github.com/alexcrichton/tar-rs",
"https://github.com/rustls/pki-types",
"https://github.com/near/cargo-near",
"https://github.com/rustls/pemfile",
"https://github.com/fitzgen/is_executable",
"https://github.com/near/near-sdk-rs",
"https://github.com/algesten/ureq",
"https://github.com/zip-rs/zip2",
"https://github.com/getsentry/symbolic",
"https://github.com/srijs/rust-tokio-retry",
"https://github.com/near/near-workspaces-rs",
"https://github.com/rustls/webpki-roots",
"https://github.com/RustCrypto/password-hashes",
"https://github.com/smol-rs/async-executor",
@@ -185,7 +179,6 @@
"https://github.com/alexcrichton/ssh2-rs",
"https://github.com/rust-cli/termtree",
"https://github.com/microsoft/TypeScript",
"https://github.com/near/near-sdk-js",
"https://github.com/assert-rs/predicates-rs",
"https://github.com/TypeStrong/typedoc",
"https://github.com/vercel/turborepo",
@@ -216,7 +209,6 @@
"https://github.com/markedjs/marked",
"https://github.com/npm/hosted-git-info",
"https://github.com/fsevents/fsevents",
"https://github.com/near/near-api-js",
"https://github.com/hildjj/nofilter",
"https://github.com/nodeca/js-yaml",
"https://github.com/jsdom/tr46",
@@ -343,7 +335,6 @@
"https://github.com/MetaMask/providers",
"https://github.com/octokit/plugin-retry.js",
"https://github.com/octokit/plugin-throttling.js",
"https://github.com/near/wallet-selector",
"https://github.com/MetaMask/object-multiplex",
"https://github.com/multiformats/js-multiaddr",
"https://github.com/paulmillr/noble-curves",
@@ -469,7 +460,6 @@
"https://github.com/vitejs/vite",
"https://github.com/unjs/uncrypto",
"https://github.com/JedWatson/classnames",
"https://github.com/near/pagoda-ui",
"https://github.com/idos-network/idos-sdk-js",
"https://github.com/twbs/bootstrap",
"https://github.com/getsentry/sentry-javascript",
@@ -539,8 +529,6 @@
"https://github.com/react-bootstrap/react-overlays",
"https://github.com/react-component/virtual-list",
"https://github.com/juliencrn/usehooks-ts",
"https://github.com/near/near-workspaces-js",
"https://github.com/near/near-sandbox",
"https://github.com/rust-rse/reed-solomon-erasure",
"https://github.com/octokit/plugin-enterprise-server.js",
"https://github.com/eslint/js",
@@ -555,4 +543,4 @@
"https://github.com/thysultan/stylis",
"https://github.com/browserify/browserify-sign",
"https://github.com/smithy-lang/smithy-typescript"
]
]
17 changes: 15 additions & 2 deletions issue_creator/src/issue_creator.mjs
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import fs from 'fs/promises';
import cliProgress from 'cli-progress';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import _ from 'lodash';

// Parse command-line arguments
const argv = yargs(hideBin(process.argv))
@@ -29,6 +30,11 @@ const argv = yargs(hideBin(process.argv))
type: "string",
default: "progress.json",
})
.option("limit", {
alias: "l",
description: "Limit the number of issues to create",
type: "number",
})
.help()
.alias("help", "h")
.parse();
@@ -127,7 +133,14 @@ async function main() {
format: ' {bar} | {percentage}% | {value}/{total} | {task}',
}, cliProgress.Presets.shades_classic);

const overallBar = multibar.create(repositories.length, 0, { task: "Overall Progress" });
let repositoriesToProcess = repositories;
if (argv.limit) {
const unprocessedRepos = repositories.filter(repo => !progress[repo] || progress[repo].error);
repositoriesToProcess = _.sampleSize(unprocessedRepos, argv.limit);
console.log(`Processing ${repositoriesToProcess.length} out of ${unprocessedRepos.length} unprocessed repositories.`);
}

const overallBar = multibar.create(repositoriesToProcess.length, 0, { task: "Overall Progress" });
const minuteRateBar = multibar.create(config.rateLimit.perMinute, 0, { task: "Minute Rate Limit" });
const hourRateBar = multibar.create(config.rateLimit.perHour, 0, { task: "Hour Rate Limit" });

@@ -138,7 +151,7 @@ async function main() {

overallBar.update(Object.keys(progress).length);

for (const repoString of repositories) {
for (const repoString of repositoriesToProcess) {
if (progress[repoString] && !progress[repoString].error) {
console.log(`Skipping ${repoString}, already processed successfully.`);
continue;

0 comments on commit 17addc8

Please sign in to comment.