diff --git a/.github/workflows/remind-and-post-eod-updates-to-slack.yaml b/.github/workflows/remind-and-post-eod-updates-to-slack.yaml deleted file mode 100644 index 85044dc1..00000000 --- a/.github/workflows/remind-and-post-eod-updates-to-slack.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: Sends reminders and Posts Contributor's EOD Updates to Slack - -on: - workflow_call: - inputs: - LEADERBOARD_URL: - type: string - required: true - description: URL to the Leaderboard Deployment (to access the EOD API's) - - secrets: - GITHUB_PAT: - required: true - - LEADERBOARD_API_KEY: - required: true - - SLACK_EOD_BOT_CHANNEL: - required: true - - SLACK_EOD_BOT_TOKEN: - required: true - -jobs: - main: - name: Remind, wait, and Post EOD updates of contributors to slack channel - runs-on: ubuntu-latest - env: - GITHUB_ORG: ${{ github.repository_owner }} - GITHUB_TOKEN: ${{ secrets.GITHUB_PAT }} - LEADERBOARD_URL: ${{ inputs.LEADERBOARD_URL }} - LEADERBOARD_API_KEY: ${{ secrets.LEADERBOARD_API_KEY }} - SLACK_EOD_BOT_CHANNEL: ${{ secrets.SLACK_EOD_BOT_CHANNEL }} - SLACK_EOD_BOT_TOKEN: ${{ secrets.SLACK_EOD_BOT_TOKEN }} - CONTRIBUTORS_DIR: "../../contributors" - steps: - - uses: actions/checkout@v4 # This pulls the caller workflow's repo (eg: ohcnetwork/leaderboard-data) - - - uses: actions/checkout@v4 - with: - repository: ohcnetwork/leaderboard - path: ./leaderboard - sparse-checkout: activities-bot - - - uses: actions/setup-node@v4 - with: - node-version: 21.x - - - run: npm install --from-lockfile - working-directory: leaderboard/activities-bot - - - name: Send reminders to eligible contributors - run: npm run remind - working-directory: leaderboard/activities-bot - - - run: sleep 30m - - - name: Post EOD Updates to Slack Channel - run: npm run post-updates - working-directory: leaderboard/activities-bot diff --git a/activities-bot/.gitignore b/activities-bot/.gitignore deleted file mode 100644 index b2af6e00..00000000 --- a/activities-bot/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -!package-lock.json \ No newline at end of file diff --git a/activities-bot/package-lock.json b/activities-bot/package-lock.json deleted file mode 100644 index 250a9d20..00000000 --- a/activities-bot/package-lock.json +++ /dev/null @@ -1,534 +0,0 @@ -{ - "name": "activities-bot", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "activities-bot", - "version": "1.0.0", - "dependencies": { - "gray-matter": "^4.0.3", - "octokit": "^4.0.2" - } - }, - "node_modules/@octokit/app": { - "version": "15.0.1", - "resolved": "https://registry.npmjs.org/@octokit/app/-/app-15.0.1.tgz", - "integrity": "sha512-nwSjC349E6/wruMCo944y1dBC7uKzUYrBMoC4Qx/xfLLBmD+R66oMKB1jXS2HYRF9Hqh/Alq3UNRggVWZxjvUg==", - "dependencies": { - "@octokit/auth-app": "^7.0.0", - "@octokit/auth-unauthenticated": "^6.0.0", - "@octokit/core": "^6.1.2", - "@octokit/oauth-app": "^7.0.0", - "@octokit/plugin-paginate-rest": "^11.0.0", - "@octokit/types": "^13.0.0", - "@octokit/webhooks": "^13.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-app": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-7.0.0.tgz", - "integrity": "sha512-2MKylF29sWO72KNI1aUMDJ/ZMOwWjePGz1VnS1B9xdY+SOGvGRUAnufH6SDWGZuwQ7WyvwkCYc0eG2IekglWwQ==", - "dependencies": { - "@octokit/auth-oauth-app": "^8.1.0", - "@octokit/auth-oauth-user": "^5.1.0", - "@octokit/request": "^9.1.1", - "@octokit/request-error": "^6.1.1", - "@octokit/types": "^13.4.1", - "lru-cache": "^10.0.0", - "universal-github-app-jwt": "^2.0.6", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-oauth-app": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-8.1.1.tgz", - "integrity": "sha512-5UtmxXAvU2wfcHIPPDWzVSAWXVJzG3NWsxb7zCFplCWEmMCArSZV0UQu5jw5goLQXbFyOr5onzEH37UJB3zQQg==", - "dependencies": { - "@octokit/auth-oauth-device": "^7.0.0", - "@octokit/auth-oauth-user": "^5.0.1", - "@octokit/request": "^9.0.0", - "@octokit/types": "^13.0.0", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-oauth-device": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-7.1.1.tgz", - "integrity": "sha512-HWl8lYueHonuyjrKKIup/1tiy0xcmQCdq5ikvMO1YwkNNkxb6DXfrPjrMYItNLyCP/o2H87WuijuE+SlBTT8eg==", - "dependencies": { - "@octokit/oauth-methods": "^5.0.0", - "@octokit/request": "^9.0.0", - "@octokit/types": "^13.0.0", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-oauth-user": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-5.1.1.tgz", - "integrity": "sha512-rRkMz0ErOppdvEfnemHJXgZ9vTPhBuC6yASeFaB7I2yLMd7QpjfrL1mnvRPlyKo+M6eeLxrKanXJ9Qte29SRsw==", - "dependencies": { - "@octokit/auth-oauth-device": "^7.0.1", - "@octokit/oauth-methods": "^5.0.0", - "@octokit/request": "^9.0.1", - "@octokit/types": "^13.0.0", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-token": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.1.tgz", - "integrity": "sha512-rh3G3wDO8J9wSjfI436JUKzHIxq8NaiL0tVeB2aXmG6p/9859aUOAjA9pmSPNGGZxfwmaJ9ozOJImuNVJdpvbA==", - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/auth-unauthenticated": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@octokit/auth-unauthenticated/-/auth-unauthenticated-6.1.0.tgz", - "integrity": "sha512-zPSmfrUAcspZH/lOFQnVnvjQZsIvmfApQH6GzJrkIunDooU1Su2qt2FfMTSVPRp7WLTQyC20Kd55lF+mIYaohQ==", - "dependencies": { - "@octokit/request-error": "^6.0.1", - "@octokit/types": "^13.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/core": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.2.tgz", - "integrity": "sha512-hEb7Ma4cGJGEUNOAVmyfdB/3WirWMg5hDuNFVejGEDFqupeOysLc2sG6HJxY2etBp5YQu5Wtxwi020jS9xlUwg==", - "dependencies": { - "@octokit/auth-token": "^5.0.0", - "@octokit/graphql": "^8.0.0", - "@octokit/request": "^9.0.0", - "@octokit/request-error": "^6.0.1", - "@octokit/types": "^13.0.0", - "before-after-hook": "^3.0.2", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/endpoint": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.1.tgz", - "integrity": "sha512-JYjh5rMOwXMJyUpj028cu0Gbp7qe/ihxfJMLc8VZBMMqSwLgOxDI1911gV4Enl1QSavAQNJcwmwBF9M0VvLh6Q==", - "dependencies": { - "@octokit/types": "^13.0.0", - "universal-user-agent": "^7.0.2" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/graphql": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.1.1.tgz", - "integrity": "sha512-ukiRmuHTi6ebQx/HFRCXKbDlOh/7xEV6QUXaE7MJEKGNAncGI/STSbOkl12qVXZrfZdpXctx5O9X1AIaebiDBg==", - "dependencies": { - "@octokit/request": "^9.0.0", - "@octokit/types": "^13.0.0", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/oauth-app": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@octokit/oauth-app/-/oauth-app-7.1.2.tgz", - "integrity": "sha512-4ntCOZIiTozKwuYQroX/ZD722tzMH8Eicv/cgDM/3F3lyrlwENHDv4flTCBpSJbfK546B2SrkKMWB+/HbS84zQ==", - "dependencies": { - "@octokit/auth-oauth-app": "^8.0.0", - "@octokit/auth-oauth-user": "^5.0.1", - "@octokit/auth-unauthenticated": "^6.0.0-beta.1", - "@octokit/core": "^6.0.0", - "@octokit/oauth-authorization-url": "^7.0.0", - "@octokit/oauth-methods": "^5.0.0", - "@types/aws-lambda": "^8.10.83", - "universal-user-agent": "^7.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/oauth-authorization-url": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-7.1.1.tgz", - "integrity": "sha512-ooXV8GBSabSWyhLUowlMIVd9l1s2nsOGQdlP2SQ4LnkEsGXzeCvbSbCPdZThXhEFzleGPwbapT0Sb+YhXRyjCA==", - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/oauth-methods": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-5.1.2.tgz", - "integrity": "sha512-C5lglRD+sBlbrhCUTxgJAFjWgJlmTx5bQ7Ch0+2uqRjYv7Cfb5xpX4WuSC9UgQna3sqRGBL9EImX9PvTpMaQ7g==", - "dependencies": { - "@octokit/oauth-authorization-url": "^7.0.0", - "@octokit/request": "^9.1.0", - "@octokit/request-error": "^6.1.0", - "@octokit/types": "^13.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/openapi-types": { - "version": "22.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", - "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==" - }, - "node_modules/@octokit/openapi-webhooks-types": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@octokit/openapi-webhooks-types/-/openapi-webhooks-types-8.2.1.tgz", - "integrity": "sha512-msAU1oTSm0ZmvAE0xDemuF4tVs5i0xNnNGtNmr4EuATi+1Rn8cZDetj6NXioSf5LwnxEc209COa/WOSbjuhLUA==" - }, - "node_modules/@octokit/plugin-paginate-graphql": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-5.2.2.tgz", - "integrity": "sha512-7znSVvlNAOJisCqAnjN1FtEziweOHSjPGAuc5W58NeGNAr/ZB57yCsjQbXDlWsVryA7hHQaEQPcBbJYFawlkyg==", - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=6" - } - }, - "node_modules/@octokit/plugin-paginate-rest": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.3.0.tgz", - "integrity": "sha512-n4znWfRinnUQF6TPyxs7EctSAA3yVSP4qlJP2YgI3g9d4Ae2n5F3XDOjbUluKRxPU3rfsgpOboI4O4VtPc6Ilg==", - "dependencies": { - "@octokit/types": "^13.5.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=6" - } - }, - "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "13.2.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.2.1.tgz", - "integrity": "sha512-YMWBw6Exh1ZBs5cCE0AnzYxSQDIJS00VlBqISTgNYmu5MBdeM07K/MAJjy/VkNaH5jpJmD/5HFUvIZ+LDB5jSQ==", - "dependencies": { - "@octokit/types": "^13.5.0" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=6" - } - }, - "node_modules/@octokit/plugin-retry": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-7.1.1.tgz", - "integrity": "sha512-G9Ue+x2odcb8E1XIPhaFBnTTIrrUDfXN05iFXiqhR+SeeeDMMILcAnysOsxUpEWcQp2e5Ft397FCXTcPkiPkLw==", - "dependencies": { - "@octokit/request-error": "^6.0.0", - "@octokit/types": "^13.0.0", - "bottleneck": "^2.15.3" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": ">=6" - } - }, - "node_modules/@octokit/plugin-throttling": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-9.3.0.tgz", - "integrity": "sha512-B5YTToSRTzNSeEyssnrT7WwGhpIdbpV9NKIs3KyTWHX6PhpYn7gqF/+lL3BvsASBM3Sg5BAUYk7KZx5p/Ec77w==", - "dependencies": { - "@octokit/types": "^13.0.0", - "bottleneck": "^2.15.3" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "@octokit/core": "^6.0.0" - } - }, - "node_modules/@octokit/request": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.1.1.tgz", - "integrity": "sha512-pyAguc0p+f+GbQho0uNetNQMmLG1e80WjkIaqqgUkihqUp0boRU6nKItXO4VWnr+nbZiLGEyy4TeKRwqaLvYgw==", - "dependencies": { - "@octokit/endpoint": "^10.0.0", - "@octokit/request-error": "^6.0.1", - "@octokit/types": "^13.1.0", - "universal-user-agent": "^7.0.2" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/request-error": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.1.tgz", - "integrity": "sha512-1mw1gqT3fR/WFvnoVpY/zUM2o/XkMs/2AszUUG9I69xn0JFLv6PGkPhNk5lbfvROs79wiS0bqiJNxfCZcRJJdg==", - "dependencies": { - "@octokit/types": "^13.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/types": { - "version": "13.5.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.5.0.tgz", - "integrity": "sha512-HdqWTf5Z3qwDVlzCrP8UJquMwunpDiMPt5er+QjGzL4hqr/vBVY/MauQgS1xWxCDT1oMx1EULyqxncdCY/NVSQ==", - "dependencies": { - "@octokit/openapi-types": "^22.2.0" - } - }, - "node_modules/@octokit/webhooks": { - "version": "13.2.7", - "resolved": "https://registry.npmjs.org/@octokit/webhooks/-/webhooks-13.2.7.tgz", - "integrity": "sha512-sPHCyi9uZuCs1gg0yF53FFocM+GsiiBEhQQV/itGzzQ8gjyv2GMJ1YvgdDY4lC0ePZeiV3juEw4GbS6w1VHhRw==", - "dependencies": { - "@octokit/openapi-webhooks-types": "8.2.1", - "@octokit/request-error": "^6.0.1", - "@octokit/webhooks-methods": "^5.0.0", - "aggregate-error": "^5.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@octokit/webhooks-methods": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@octokit/webhooks-methods/-/webhooks-methods-5.1.0.tgz", - "integrity": "sha512-yFZa3UH11VIxYnnoOYCVoJ3q4ChuSOk2IVBBQ0O3xtKX4x9bmKb/1t+Mxixv2iUhzMdOl1qeWJqEhouXXzB3rQ==", - "engines": { - "node": ">= 18" - } - }, - "node_modules/@types/aws-lambda": { - "version": "8.10.137", - "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.137.tgz", - "integrity": "sha512-YNFwzVarXAOXkjuFxONyDw1vgRNzyH8AuyN19s0bM+ChSu/bzxb5XPxYFLXoqoM+tvgzwR3k7fXcEOW125yJxg==" - }, - "node_modules/aggregate-error": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz", - "integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==", - "dependencies": { - "clean-stack": "^5.2.0", - "indent-string": "^5.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/before-after-hook": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz", - "integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==" - }, - "node_modules/bottleneck": { - "version": "2.19.5", - "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", - "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==" - }, - "node_modules/clean-stack": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz", - "integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==", - "dependencies": { - "escape-string-regexp": "5.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gray-matter": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", - "integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==", - "dependencies": { - "js-yaml": "^3.13.1", - "kind-of": "^6.0.2", - "section-matter": "^1.0.0", - "strip-bom-string": "^1.0.0" - }, - "engines": { - "node": ">=6.0" - } - }, - "node_modules/indent-string": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", - "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lru-cache": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", - "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", - "engines": { - "node": "14 || >=16.14" - } - }, - "node_modules/octokit": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/octokit/-/octokit-4.0.2.tgz", - "integrity": "sha512-wbqF4uc1YbcldtiBFfkSnquHtECEIpYD78YUXI6ri1Im5OO2NLo6ZVpRdbJpdnpZ05zMrVPssNiEo6JQtea+Qg==", - "dependencies": { - "@octokit/app": "^15.0.0", - "@octokit/core": "^6.0.0", - "@octokit/oauth-app": "^7.0.0", - "@octokit/plugin-paginate-graphql": "^5.0.0", - "@octokit/plugin-paginate-rest": "^11.0.0", - "@octokit/plugin-rest-endpoint-methods": "^13.0.0", - "@octokit/plugin-retry": "^7.0.0", - "@octokit/plugin-throttling": "^9.0.0", - "@octokit/request-error": "^6.0.0", - "@octokit/types": "^13.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/section-matter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", - "integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==", - "dependencies": { - "extend-shallow": "^2.0.1", - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" - }, - "node_modules/strip-bom-string": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", - "integrity": "sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/universal-github-app-jwt": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-2.2.0.tgz", - "integrity": "sha512-G5o6f95b5BggDGuUfKDApKaCgNYy2x7OdHY0zSMF081O0EJobw+1130VONhrA7ezGSV2FNOGyM+KQpQZAr9bIQ==" - }, - "node_modules/universal-user-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz", - "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==" - } - } -} diff --git a/activities-bot/package.json b/activities-bot/package.json deleted file mode 100644 index 803b2b23..00000000 --- a/activities-bot/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "activities-bot", - "version": "1.0.0", - "description": "", - "scripts": { - "remind": "node src/sendReminder.mjs", - "post-updates": "node src/postUpdates.mjs" - }, - "type": "module", - "dependencies": { - "gray-matter": "^4.0.3", - "octokit": "^4.0.2" - } -} diff --git a/activities-bot/src/postUpdates.mjs b/activities-bot/src/postUpdates.mjs deleted file mode 100644 index 05cdd090..00000000 --- a/activities-bot/src/postUpdates.mjs +++ /dev/null @@ -1,45 +0,0 @@ -import { - getContributors, - getEvents, - getEODUpdates, - postEODMessage, - mergeUpdates, - flushEODUpdates, -} from "./utils.mjs"; - -async function main() { - const allContributors = await getContributors(); - console.info(`⚙️ Found ${Object.keys(allContributors).length} contributors`); - - console.info("⚙️ Fetching events from GitHub"); - const allEvents = await getEvents(Object.keys(allContributors)); - - console.info("⚙️ Fetching General EOD updates"); - const allEodUpdates = await getEODUpdates(); - - console.info("⚙️ Ready to post EOD updates onto Slack Channel"); - for (const [github, slack] of Object.entries(allContributors)) { - const events = allEvents[github] ?? []; - const eodUpdates = allEodUpdates[github] ?? []; - - const activityCount = events.length + eodUpdates.length; - if (activityCount === 0) { - console.info(`- ⏭️ ${github}: Skipping due to no activity.`); - continue; - } - - await postEODMessage({ - github, - slack, - updates: mergeUpdates(events, eodUpdates), - }); - console.info(`- ✅ ${github}: Posted ${activityCount} updates.`); - } - - console.info("Flushing EOD updates from cache."); - await flushEODUpdates(); - - console.info("✅ Completed!"); -} - -main(); diff --git a/activities-bot/src/sendReminder.mjs b/activities-bot/src/sendReminder.mjs deleted file mode 100644 index b67f0b89..00000000 --- a/activities-bot/src/sendReminder.mjs +++ /dev/null @@ -1,51 +0,0 @@ -import { - getContributors, - getEODUpdates, - sendSlackMessage, - withRetry, -} from "./utils.mjs"; - -const remind = async ({ slackId, updates }) => { - await sendSlackMessage( - slackId, - ` - Good Evening <@${slackId}> :wave:, - ${formatUpdatesMessage(updates)}`, - ); -}; - -const formatUpdatesMessage = (updates) => { - if (updates?.length) { - return ` -Here are your updates for today: - -${updates.map((update, i) => `${i + 1}. ${update}`).join("\n")} - -_If you wish to add more updates, *send each of the update as an individual message*._ -_If you wish to clear or re-write your updates, message *\`clear updates\`*._ -_These updates will be sent to the channel at the end of the working day along with your contribution data from GitHub._ - `; - } - - return ` -You have not specified any EOD updates for today. -If you wish to add updates, *send each of the update as an individual message*.`; -}; - -async function main() { - const allContributors = await getContributors(); - console.info(`⚙️ Found ${Object.keys(allContributors).length} contributors`); - - console.info("⚙️ Fetching General EOD updates"); - const eodUpdates = await getEODUpdates(); - - console.info("⚙️ Reminding users..."); - for (const [githubId, slackId] of Object.entries(allContributors)) { - await withRetry(() => remind({ slackId, updates: eodUpdates[githubId] }), { - attempts: 3, - }); - } - console.info("✅ Completed!"); -} - -main(); diff --git a/activities-bot/src/utils.mjs b/activities-bot/src/utils.mjs deleted file mode 100644 index 8b6ff7e2..00000000 --- a/activities-bot/src/utils.mjs +++ /dev/null @@ -1,285 +0,0 @@ -import { readFile, readdir } from "fs/promises"; -import { join } from "path"; -import matter from "gray-matter"; -import { Octokit } from "octokit"; - -const root = - process.env.CONTRIBUTORS_DIR || join(process.cwd(), "data-repo/contributors"); - -async function getContributorBySlug(file) { - const { data } = matter(await readFile(join(root, file), "utf8")); - return { - github: file.replace(/\.md$/, ""), - slack: data.slack, - }; -} - -export async function getContributors() { - const slugs = await readdir(`${root}`); - const contributors = await Promise.all( - slugs.map((path) => getContributorBySlug(path)), - ); - - return Object.fromEntries( - contributors - .filter((contributor) => !!contributor.slack) - .map((c) => [c.github, c.slack]), - ); -} - -const GITHUB_ORG = process.env.GITHUB_ORG; -const GITHUB_TOKEN = process.env.GITHUB_TOKEN; -const LEADERBOARD_API_KEY = process.env.LEADERBOARD_API_KEY; -const LEADERBOARD_URL = process.env.LEADERBOARD_URL; -const SLACK_EOD_BOT_TOKEN = process.env.SLACK_EOD_BOT_TOKEN; -const SLACK_EOD_BOT_CHANNEL = process.env.SLACK_EOD_BOT_CHANNEL; - -function isAllowedEvent(event) { - if (event.type === "PullRequestEvent") { - return event.payload.action === "opened"; - } - - if (event.type === "PullRequestReviewEvent") { - return true; - } -} - -const throwForHttpError = async (promise) => { - const res = await promise; - - if (!res.ok) { - throw new Error(await res.text()); - } - - return res; -}; - -const octokit = new Octokit({ auth: GITHUB_TOKEN }); - -export async function getEvents(allowedAuthors) { - const aDayAgoDate = new Date(); - aDayAgoDate.setDate(aDayAgoDate.getDate() - 1); - const aDayAgo = aDayAgoDate.getTime(); - - const events = await octokit.paginate( - "GET /orgs/{org}/events", - { org: GITHUB_ORG, per_page: 1000 }, - (res) => - res.data.filter( - (event) => - allowedAuthors.includes(event.actor.login) && - isAllowedEvent(event) && - event.created_at && - new Date(event.created_at).getTime() > aDayAgo, - ), - ); - - return Object.groupBy(events, (e) => e.actor.login); -} - -export function mergeUpdates(events, eodUpdates) { - const updates = []; - const counts = { - eod_updates: eodUpdates.length, - pull_requests: 0, - reviews: 0, - }; - - updates.push(...eodUpdates.map((title) => ({ title }))); - - for (const event of events) { - if (event.type === "PullRequestReviewEvent") { - const url = event.payload.pull_request.html_url; - if (!updates.find((a) => a.url === url)) { - counts.reviews += 1; - updates.push({ - title: `Reviewed PR: "${event.payload.pull_request.title}"`, - url, - }); - } - } - - if ( - event.type === "PullRequestEvent" && - event.payload.action === "opened" - ) { - counts.pull_requests += 1; - updates.push({ - title: `Opened PR: "${event.payload.pull_request.title}"`, - url: event.payload.pull_request.html_url, - }); - } - } - - return { updates, counts }; -} - -const leaderboardApiHeaders = { - "Content-Type": "application/json", - Authorization: `${LEADERBOARD_API_KEY}`, -}; - -const eodUpdatesApi = `${LEADERBOARD_URL}/api/slack-eod-bot/eod-updates`; - -export async function getEODUpdates() { - const res = await throwForHttpError( - fetch(eodUpdatesApi, { - headers: leaderboardApiHeaders, - }), - ); - - return res.json(); -} - -export async function flushEODUpdates() { - const res = await throwForHttpError( - fetch(eodUpdatesApi, { - headers: leaderboardApiHeaders, - method: "DELETE", - }), - ); -} - -const slackApiHeaders = { - "Content-Type": "application/json", - Authorization: `Bearer ${SLACK_EOD_BOT_TOKEN}`, -}; - -export async function sendSlackMessage(channel, text, blocks) { - const res = await throwForHttpError( - fetch("https://slack.com/api/chat.postMessage", { - method: "POST", - headers: slackApiHeaders, - body: JSON.stringify({ - channel, - text, - ...blocks, - }), - }), - ); - - const data = await res.json(); - if (!data.ok) { - console.error(data); - } -} - -function getHumanReadableUpdates({ updates, counts }, slackID, githubId) { - const colorRange = [ - { color: "#00FF00", min: 5 }, - { color: "#FFFF00", min: 1 }, - { color: "#FF0000", min: 0 }, - ]; - - const activityCount = - counts.pull_requests + counts.reviews + counts.eod_updates; - - const color = - colorRange.find((range) => range.min <= activityCount)?.color || "#0000FF"; - - return { - attachments: [ - { - color, - blocks: [ - { - type: "section", - text: { - type: "mrkdwn", - text: ` -*EOD Updates for <@${slackID}>* - -Summary: Opened *${counts.pull_requests}* pull requests, Reviewed *${counts.reviews}* PRs and *${counts.eod_updates}* other general updates. - - | <${LEADERBOARD_URL}/contributors/${githubId}|Contributor Profile> -`, - }, - accessory: { - type: "image", - image_url: `https://avatars.githubusercontent.com/${githubId}?s=128`, - alt_text: "profile image", - }, - }, - - { - type: "divider", - }, - { - type: "rich_text", - elements: [ - { - type: "rich_text_section", - elements: [ - { - type: "text", - text: "Updates:", - style: { bold: true }, - }, - { - type: "text", - text: `\n${updates.length === 0 ? "No updates for today" : ""}`, - }, - ], - }, - { - type: "rich_text_list", - style: "bullet", - elements: updates.map((item) => { - const elements = [ - { - type: "text", - text: item.title, - }, - ]; - - if (item.url) { - let preview = ""; - - if (item.url.startsWith("https://github.com")) { - preview = item.url.replace("https://github.com/", ""); - const [org, repo, type, number] = preview.split("/"); - preview = `${repo}#${number.split("#")[0]}`; - } - - elements.push({ - type: "link", - text: ` ${preview} ↗`, - url: item.url, - }); - } - - return { - type: "rich_text_section", - elements, - }; - }), - }, - ], - }, - ], - }, - ], - }; -} - -export async function postEODMessage({ github, slack, updates }) { - await sendSlackMessage( - SLACK_EOD_BOT_CHANNEL, - "", - getHumanReadableUpdates(updates, slack, github), - ); -} - -export async function withRetry(method, { attempts }) { - while (attempts) { - try { - return await method(); - } catch (error) { - attempts -= 1; - - if (!attempts) { - throw error; - } - } - } -} diff --git a/next-env.d.ts b/next-env.d.ts index 4f11a03d..40c3d680 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.