Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user activity watch #1

Merged
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
2c3f074
chore: added base content
gentlementlegen Jun 2, 2024
561ebf5
chore: added more base content
gentlementlegen Jun 2, 2024
141a332
chore: added github action
gentlementlegen Jun 2, 2024
499d254
chore: added env parsing
gentlementlegen Jun 3, 2024
83d1e77
chore: fixed workflows
gentlementlegen Jun 3, 2024
037f7f3
chore: callback proxy
gentlementlegen Jun 3, 2024
417b278
chore: added handlers
gentlementlegen Jun 3, 2024
f6a065f
chore: added adapters
gentlementlegen Jun 3, 2024
fb4be18
feat: database generation script
gentlementlegen Jun 3, 2024
6f19d4d
feat: database generation script
gentlementlegen Jun 3, 2024
2b1aaee
chore: fix workflow
gentlementlegen Jun 3, 2024
d5824e5
chore: fix workflow
gentlementlegen Jun 3, 2024
f256464
chore: fix commit name
gentlementlegen Jun 3, 2024
a1f914d
chore: content write permission
gentlementlegen Jun 3, 2024
bb6a386
chore: updated generated Supabase types
github-actions[bot] Jun 3, 2024
86d6aee
chore: db migration
gentlementlegen Jun 3, 2024
d8bab65
chore: updated generated Supabase types
github-actions[bot] Jun 3, 2024
0f25746
chore: cspell ignore path
gentlementlegen Jun 3, 2024
dce9745
chore: cspell ignore path for migrations
gentlementlegen Jun 3, 2024
68c72e3
chore: check for empty commits
gentlementlegen Jun 3, 2024
b1c379a
chore: fix lint stage
gentlementlegen Jun 3, 2024
4014c0b
chore: time estimate calculation
gentlementlegen Jun 3, 2024
aeba8b4
chore: added missing action file
gentlementlegen Jun 3, 2024
47b64a9
chore: added missing start command
gentlementlegen Jun 3, 2024
7deda8b
chore: added missing package tsx
gentlementlegen Jun 3, 2024
c2fbb92
chore: moved tsx to deps
gentlementlegen Jun 3, 2024
f97acec
chore: fixed proxy
gentlementlegen Jun 3, 2024
1eb4e1a
chore: fixed label fetch
gentlementlegen Jun 3, 2024
e191bb7
chore: added worker
gentlementlegen Jun 3, 2024
be21381
chore(main): release 1.0.0
github-actions[bot] Jun 4, 2024
154ae53
chore: added http test
gentlementlegen Jun 4, 2024
c7d955a
chore: fix yarn
gentlementlegen Jun 4, 2024
67fbf0a
chore: fix worker spawn
gentlementlegen Jun 4, 2024
31e3e76
chore: handlers for user assign change
gentlementlegen Jun 4, 2024
4449c3e
chore: added get adapter for repos
gentlementlegen Jun 4, 2024
258cde0
chore: handling multiple assignees
gentlementlegen Jun 4, 2024
db78f71
chore: check last activity
gentlementlegen Jun 4, 2024
797cd6e
feat: user get reminded and unassigned
gentlementlegen Jun 7, 2024
984c9ea
chore: updated generated Supabase types
github-actions[bot] Jun 7, 2024
e05f98a
Merge pull request #1 from Meniole/release-please--branches--main--co…
gentlementlegen Jun 7, 2024
1daac92
chore: updated generated Supabase types
github-actions[bot] Jun 7, 2024
d244367
chore: assignees null check
gentlementlegen Jun 7, 2024
e9c0ab4
chore: updated generated Supabase types
github-actions[bot] Jun 7, 2024
8a87bb4
chore: fixed cspell
gentlementlegen Jun 7, 2024
651ca02
chore: added helping logs
gentlementlegen Jun 7, 2024
b8fb622
chore: get single update on issue
gentlementlegen Jun 7, 2024
2464807
chore: check activity from last check
gentlementlegen Jun 7, 2024
9c09297
chore: added info for no action
gentlementlegen Jun 7, 2024
3c6e6ad
chore: fixed log
gentlementlegen Jun 7, 2024
af26d55
chore: fixed payloads
gentlementlegen Jun 7, 2024
a21d33c
chore: added conditions for updating the db
gentlementlegen Jun 7, 2024
66b4869
chore: change retrieval of repo info
gentlementlegen Jun 7, 2024
f3201f1
chore: changed Jest trigger
gentlementlegen Jun 10, 2024
5d9f77e
chore: updated README.md
gentlementlegen Jun 10, 2024
05a582b
chore: fixed reminder log
gentlementlegen Jun 10, 2024
7dd945b
chore: disabled cloudflare workflow
gentlementlegen Jun 10, 2024
c834de9
feat: added testing
gentlementlegen Jun 10, 2024
58dfe8f
chore: fixed knip
gentlementlegen Jun 10, 2024
80deb87
chore: fixed knip
gentlementlegen Jun 10, 2024
cb55e61
fix: moved get env outside of main file
gentlementlegen Jun 10, 2024
8c05862
chore: fixed knip again
gentlementlegen Jun 10, 2024
d86fe10
Merge pull request #4 from Meniole/development
gentlementlegen Jun 10, 2024
cbe357b
chore: removed promise rejection
gentlementlegen Jun 13, 2024
d23a7d3
chore: moved get github issue function
gentlementlegen Jun 13, 2024
962aa74
chore: renamed function to removeAllAssignees
gentlementlegen Jun 13, 2024
2b25457
chore: renamed repositories to issues
gentlementlegen Jun 13, 2024
99fa8f7
feat: changed the time parsing to be with ms package
gentlementlegen Jun 13, 2024
e1aa81c
chore: moved filter out of the function
gentlementlegen Jun 13, 2024
85472f9
chore: removed CHANGELOG.md
gentlementlegen Jun 13, 2024
a52b644
chore: fixed tests
gentlementlegen Jun 13, 2024
b51edf8
chore: fixed cspell
gentlementlegen Jun 13, 2024
7580adf
chore: changed promise resolve to throw
gentlementlegen Jun 13, 2024
83936a1
Update src/helpers/time.ts
gentlementlegen Jun 15, 2024
b54e387
Update src/worker.ts
gentlementlegen Jun 15, 2024
b560541
Update src/worker.ts
gentlementlegen Jun 15, 2024
2c205d7
chore: added custom support for months
gentlementlegen Jun 18, 2024
c36f971
chore: added tests for singular and plural time durations
gentlementlegen Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "**/*.http", "**/*.toml", "src/types/database.ts", "supabase/migrations/**", "tests/**"],
"useGitignore": true,
"language": "en",
"words": ["dataurl", "devpool", "outdir", "servedir", "typebox", "supabase", "ubiquibot", "mswjs", "luxon", "millis"],
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"]
}
2 changes: 2 additions & 0 deletions .dev.vars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SUPABASE_URL=
SUPABASE_KEY=
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SUPABASE_URL=
SUPABASE_KEY=
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./** @gentlementlegen
13 changes: 13 additions & 0 deletions .github/knip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { KnipConfig } from "knip";

const config: KnipConfig = {
entry: ["build/index.ts"],
project: ["src/**/*.ts"],
ignore: ["**/__mocks__/**", "**/__fixtures__/**", "src/types/database.ts"],
ignoreExportsUsedInFile: true,
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "eslint-plugin-filename-rules", "eslint-plugin-sonarjs", "@types/jest", "msw"],
eslint: true,
};

export default config;
6 changes: 6 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Resolves #

<!--
- You must link the issue number e.g. "Resolves #1234"
- Please do not replace the keyword "Resolves" https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->
40 changes: 40 additions & 0 deletions .github/workflows/compute.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Watch Activity

on:
workflow_dispatch:
inputs:
stateId:
description: "State Id"
eventName:
description: "Event Name"
eventPayload:
description: "Event Payload"
settings:
description: "Settings"
authToken:
description: "Auth Token"
ref:
description: "Ref"

jobs:
compute:
name: User Activity Watcher
runs-on: ubuntu-latest
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- run: ${{ toJSON(inputs) }}
shell: cat {0}

- name: Watch Activity
uses: ./
12 changes: 12 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Conventional Commits

on:
push:

jobs:
conventional-commits:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ubiquity/action-conventional-commits@master
24 changes: 24 additions & 0 deletions .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Spell Check

on:
push:

jobs:
spellcheck:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- name: Install cspell
run: yarn add cspell

- name: Run cspell
run: yarn format:cspell
67 changes: 67 additions & 0 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Database

on:
push:
branches:
- main

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}

jobs:
run-migration:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- uses: supabase/setup-cli@v1
with:
version: latest

- name: Link Supabase project
run: supabase link --project-ref $SUPABASE_PROJECT_ID

- name: Run migrations
run: supabase db push

generate_types:
runs-on: ubuntu-latest
needs:
- run-migration
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- name: Generate Supabase Types
run: |
yarn install
yarn run "supabase:generate:remote"

- name: Commit and Push generated types
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add src/types/database.ts
if [ -n "$(git diff-index --cached --name-only HEAD)" ]; then
git commit -m "chore: updated generated Supabase types" || echo "Lint-staged check failed"
git push origin main
else
echo "No changes to commit"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy to Cloudflare Pages

on:
workflow_dispatch:

jobs:
deploy-to-cloudflare:
name: Automatic Cloudflare Deploy
runs-on: ubuntu-22.04
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
- uses: actions/checkout@v4
- uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: '3.57.0'
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
secrets: |
SUPABASE_URL
SUPABASE_KEY
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
33 changes: 33 additions & 0 deletions .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run Jest testing suite
on:
workflow_dispatch:
workflow_run:
workflows: ["Knip"]
types:
- completed

env:
NODE_ENV: "test"
SUPABASE_URL: "http://127.0.0.1:54321"
SUPABASE_KEY: "key"

jobs:
testing:
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- uses: actions/checkout@master
with:
fetch-depth: 0

- name: Jest With Coverage Comment
# Ensures this step is run even on previous step failure (e.g. test failed)
if: always()
uses: ArtiomTr/jest-coverage-report-action@v2
with:
package-manager: yarn
prnumber: ${{ github.event.pull_request.number || github.event.workflow_run.pull_requests[0].number }}
40 changes: 40 additions & 0 deletions .github/workflows/knip-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Knip-reporter

on:
workflow_run:
workflows: ["Knip"]
types:
- completed

permissions: write-all

jobs:
knip-reporter:
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: knip-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Read pr number
id: pr-number
uses: juliangruber/read-file-action@v1
with:
path: ./pr-number.txt
trim: true

- name: Report knip results to pull request
if: ${{ github.event.workflow_run.conclusion != 'success' }}
uses: gitcoindev/knip-reporter@main
with:
verbose: true
comment_id: ${{ github.workflow }}-reporter
command_script_name: knip-ci
annotations: true
ignore_results: false
json_input: true
json_input_file_name: knip-results.json
pull_request_number: ${{ steps.pr-number.outputs.content }}
token: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Knip

on:
pull_request:
workflow_dispatch:

jobs:
run-knip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.10.0

- name: Install toolchain
run: yarn install

- name: Store PR number
run: echo ${{ github.event.number }} > pr-number.txt

- name: Run Knip
run: yarn knip || yarn knip --reporter json > knip-results.json

- name: Upload knip result
if: failure()
uses: actions/upload-artifact@v4
with:
name: knip-results
path: |
knip-results.json
pr-number.txt
19 changes: 19 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: release-please

on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
release-type: simple
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# macOS
.DS_Store
# node
node_modules
# yarn2
.yarn
.pnp.cjs
.pnp.loader.mjs
.env
static/dist
coverage
junit.xml
cypress/screenshots
.dev.vars
/tests/http/http-client.private.env.json
.wrangler
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.10.0
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"printWidth": 160,
"htmlWhitespaceSensitivity": "strict",
"plugins": [],
"useTabs": false
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
Loading