-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from ubiquity-os-marketplace/development
October Sync
- Loading branch information
Showing
61 changed files
with
2,112 additions
and
1,709 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: "Update Configuration" | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
update: | ||
name: "Update Configuration in manifest.json" | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.10.0" | ||
|
||
- name: Install deps and run configuration update | ||
run: | | ||
yarn install --immutable --immutable-cache --check-cache | ||
yarn tsc --noCheck --project tsconfig.json | ||
- name: Update manifest configuration using GitHub Script | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
(async () => { | ||
const fs = await import('fs/promises'); | ||
const path = await import('path'); | ||
const { pluginSettingsSchema } = await import("${{ github.workspace }}/src/types/plugin-inputs.js"); | ||
const manifestPath = path.resolve("${{ github.workspace }}", './manifest.json'); | ||
const manifest = JSON.parse(await fs.readFile(manifestPath, 'utf8')); | ||
const configuration = JSON.stringify(pluginSettingsSchema); | ||
manifest["configuration"] = JSON.parse(configuration); | ||
const updatedManifest = JSON.stringify(manifest, null, 2); | ||
console.log('Updated manifest:', updatedManifest); | ||
await fs.writeFile(manifestPath, updatedManifest); | ||
})(); | ||
- name: Commit and Push generated types | ||
run: | | ||
git config --global user.name 'ubiquity-os[bot]' | ||
git config --global user.email 'ubiquity-os[bot]@users.noreply.github.com' | ||
git add ./manifest.json | ||
if [ -n "$(git diff-index --cached --name-only HEAD)" ]; then | ||
git commit -m "chore: updated generated configuration" || echo "Lint-staged check failed" | ||
git push origin HEAD:${{ github.ref_name }} | ||
else | ||
echo "No changes to commit" | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ cypress/screenshots | |
.dev.vars | ||
/tests/http/http-client.private.env.json | ||
.wrangler | ||
test-dashboard.md |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Changelog | ||
|
||
## 1.0.0 (2024-07-09) | ||
|
||
### Features | ||
|
||
- added testing ([c834de9](https://github.com/ubiquibot/user-activity-watcher/commit/c834de9edefce23c11dc4d91ecc48d7e16ed3e5f)) | ||
- changed the time parsing to be with ms package ([99fa8f7](https://github.com/ubiquibot/user-activity-watcher/commit/99fa8f74524552b8dd17ae0dd6a66da3782abab3)) | ||
- database generation script ([6f19d4d](https://github.com/ubiquibot/user-activity-watcher/commit/6f19d4d0722dbcfd4e3b59ce1dddb94a550a20ac)) | ||
- database generation script ([fb4be18](https://github.com/ubiquibot/user-activity-watcher/commit/fb4be189de5c07794d05099acc9b61991f9813bf)) | ||
- linked pull request activity is now taken into account ([790d1c1](https://github.com/ubiquibot/user-activity-watcher/commit/790d1c12e3b1d716e72756e486723c3fe018d252)) | ||
- threshold can be expressed as human-readable strings ([df167d0](https://github.com/ubiquibot/user-activity-watcher/commit/df167d0b29335c1143ff6e1e6c2f11f0529e59c5)) | ||
- user get reminded and unassigned ([797cd6e](https://github.com/ubiquibot/user-activity-watcher/commit/797cd6e27788e119de27722118fbcf766ce4e79a)) | ||
|
||
### Bug Fixes | ||
|
||
- moved get env outside of main file ([cb55e61](https://github.com/ubiquibot/user-activity-watcher/commit/cb55e610d5ec2d7dd936f97155f2cc1814c1302d)) | ||
- updated Jest test comment ([d6d5e28](https://github.com/ubiquibot/user-activity-watcher/commit/d6d5e2881a106568f1b2eb6ba9710041dba75950)) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,51 @@ | ||
# @ubiquibot/user-activity-watcher | ||
|
||
Watches user activity on issues, sends reminders on deadlines, and eventually unassigns inactive user to ensure that | ||
Watches user activity on issues, sends reminders on deadlines, and eventually unassigns inactive user to ensure that | ||
tasks don't stall, and subtracts XP. | ||
|
||
## Setup | ||
|
||
```shell | ||
yarn install | ||
``` | ||
|
||
Then copy `.dev.vars.example` to `.dev.vars` and fill the required values. | ||
|
||
### Database | ||
|
||
To start a local instance, run | ||
|
||
```shell | ||
supabase start | ||
``` | ||
|
||
Afterward, you can generate types for full auto-completion with | ||
```shell | ||
yarn supabase:generate:local | ||
``` | ||
|
||
### Worker | ||
Start the Worker by running | ||
```shell | ||
yarn dev | ||
``` | ||
|
||
### Make requests | ||
To trigger the worker, `POST` requests should be made to http://localhost:4000 with a `Content-Type: application/json` | ||
header and a body looking like | ||
```json | ||
{ | ||
"stateId": "", | ||
"eventName": "", | ||
"eventPayload": "", | ||
"settings": "", | ||
"ref": "" | ||
} | ||
yarn supabase:generate:local | ||
``` | ||
For convenience, you can find an `.http` file with a valid request [here](/tests/http/request.http). | ||
|
||
### Test | ||
|
||
To start Jest testing, run | ||
|
||
```shell | ||
yarn test | ||
``` | ||
|
||
## Valid configuration | ||
|
||
```yaml | ||
- plugin: ubiquibot/user-activity-watcher | ||
type: github | ||
with: | ||
disqualification: "7 days" | ||
warning: "3.5 days" | ||
watch: | ||
optOut: | ||
- "repoName" | ||
- "repoName2" | ||
eventWhitelist: # these are the tail of the webhook event i.e pull_request.review_requested | ||
- "review_requested" | ||
- "ready_for_review" | ||
- "commented" | ||
- "committed" | ||
``` |
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
schema: | ||
- https://api.github.com/graphql: | ||
headers: | ||
Authorization: Bearer ${GITHUB_TOKEN} | ||
documents: src/handlers/collect-linked-pulls.ts | ||
projects: {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "User activity watcher", | ||
"description": "Watches user activity on issues, sends reminders on deadlines, and unassign inactive users.", | ||
"ubiquity:listeners": [ | ||
"pull_request_review_comment.created", | ||
"issue_comment.created", | ||
"push" | ||
], | ||
"configuration": { | ||
"default": {}, | ||
"type": "object", | ||
"properties": { | ||
"warning": { | ||
"default": "3.5 days", | ||
"type": "string" | ||
}, | ||
"watch": { | ||
"type": "object", | ||
"properties": { | ||
"optOut": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"optOut" | ||
] | ||
}, | ||
"disqualification": { | ||
"default": "7 days", | ||
"type": "string" | ||
}, | ||
"eventWhitelist": { | ||
"default": [ | ||
"pull_request.review_requested", | ||
"pull_request.ready_for_review", | ||
"pull_request_review_comment.created", | ||
"issue_comment.created", | ||
"push" | ||
], | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"warning", | ||
"watch", | ||
"disqualification", | ||
"eventWhitelist" | ||
] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,14 @@ | |
"name": "user-activity-watcher", | ||
"version": "1.0.0", | ||
"description": "Watches user activity on issues, sends reminders on deadlines, and unassign inactive users.", | ||
"main": "src/worker.ts", | ||
"main": "src/index.ts", | ||
"author": "Ubiquity DAO", | ||
"license": "MIT", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=20.10.0" | ||
}, | ||
"scripts": { | ||
"dev": "wrangler dev --env dev --port 4000", | ||
"start": "tsx src/index.ts", | ||
"prebuild": "dotenv -- cross-env yarn supabase:generate:remote", | ||
"format:lint": "eslint --fix .", | ||
|
@@ -32,10 +32,11 @@ | |
"dependencies": { | ||
"@actions/core": "1.10.1", | ||
"@actions/github": "6.0.0", | ||
"@octokit/graphql-schema": "^15.25.0", | ||
"@octokit/rest": "20.1.1", | ||
"@octokit/webhooks": "13.2.7", | ||
"@sinclair/typebox": "0.32.31", | ||
"@supabase/supabase-js": "2.43.4", | ||
"@ubiquity-dao/ubiquibot-logger": "^1.3.1", | ||
"dotenv": "16.4.5", | ||
"luxon": "3.4.4", | ||
"ms": "2.1.3", | ||
|
@@ -48,6 +49,7 @@ | |
"@cspell/dict-node": "5.0.1", | ||
"@cspell/dict-software-terms": "3.4.0", | ||
"@cspell/dict-typescript": "3.1.5", | ||
"@jest/globals": "^29.7.0", | ||
"@mswjs/data": "0.16.1", | ||
"@types/jest": "29.5.12", | ||
"@types/luxon": "3.4.2", | ||
|
@@ -71,8 +73,7 @@ | |
"prettier": "3.3.0", | ||
"supabase": "1.176.9", | ||
"ts-jest": "29.1.4", | ||
"typescript": "5.4.5", | ||
"wrangler": "3.58.0" | ||
"typescript": "5.6.2" | ||
}, | ||
"lint-staged": { | ||
"*.ts": [ | ||
|
@@ -87,5 +88,6 @@ | |
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.