Skip to content

Commit

Permalink
Merge pull request #15 from ubiquibot/development
Browse files Browse the repository at this point in the history
Merge develop into main
  • Loading branch information
gentlementlegen authored Jul 25, 2024
2 parents 9a7ab87 + b3045c3 commit 9f4d3e7
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 171 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Run Jest testing suite
on:
workflow_dispatch:
workflow_run:
workflows: ["Knip"]
types:
- completed
pull_request:

env:
NODE_ENV: "test"
SUPABASE_URL: "http://127.0.0.1:3000"
SUPABASE_KEY: "supabase-key"

jobs:
testing:
Expand All @@ -21,14 +20,13 @@ jobs:
- uses: actions/checkout@master
with:
fetch-depth: 0

- name: Enable corepack
run: corepack enable

- name: Jest With Coverage Comment
# Ensures this step is run even on previous step failure (e.g. test failed)
- name: Jest With Coverage
run: yarn install && yarn test

- name: Add Jest Report to Summary
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 }}
run: echo "$(cat test-dashboard.md)" >> $GITHUB_STEP_SUMMARY
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
if: ${{ github.event.workflow_run.conclusion != 'success' }}
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
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 }}
26 changes: 15 additions & 11 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Knip

on:
pull_request_target:
pull_request:
workflow_dispatch:

permissions: write-all

jobs:
run-knip:
runs-on: ubuntu-latest
Expand All @@ -17,18 +15,24 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.10.0

- name: Enable corepack
run: corepack enable

- name: Install toolchain
run: yarn install

- name: Report knip results to pull request
uses: Codex-/knip-reporter@v2
- 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:
verbose: true
comment_id: ${{ github.workflow }}-reporter
command_script_name: knip-ci
annotations: true
ignore_results: false
name: knip-results
path: |
knip-results.json
pr-number.txt
14 changes: 4 additions & 10 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
branches:
- $default-branch
- main

permissions:
contents: write
Expand All @@ -14,13 +14,7 @@ jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- uses: googleapis/release-please-action@v4
with:
release-type: node
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: "20.10.0"
registry-url: https://registry.npmjs.org/
- run: |
yarn install --immutable --immutable-cache --check-cache
release-type: simple
target-branch: main
15 changes: 15 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Start | Stop",
"description": "Assign or un-assign yourself from an issue.",
"ubiquity:listeners": [ "issue_comment.created" ],
"commands": {
"start": {
"ubiquity:example": "/start",
"description": "Assign yourself to the issue."
},
"stop": {
"ubiquity:example": "/stop",
"description": "Unassign yourself from the issue."
}
}
}
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@ubiquibot/command-start-stop",
"version": "1.0.0",
"description": "Enables the assignment and graceful unassignment of tasks to contributors.",
"main": "build/index.ts",
"main": "src/worker.ts",
"author": "Ubiquity DAO",
"license": "MIT",
"engines": {
Expand All @@ -29,8 +29,6 @@
"open-source"
],
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@octokit/rest": "^20.0.2",
"@octokit/webhooks": "^13.1.0",
"@sinclair/typebox": "^0.32.5",
Expand Down
48 changes: 0 additions & 48 deletions src/main.ts

This file was deleted.

8 changes: 3 additions & 5 deletions src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Context } from "./types/context";
import { userStartStop } from "./handlers/user-start-stop";
import { Env, PluginInputs } from "./types";

import { Octokit } from "@octokit/rest";
import { createClient } from "@supabase/supabase-js";
import { createAdapters } from "./adapters";
import { Logs } from "@ubiquity-dao/ubiquibot-logger";
import { createAdapters } from "./adapters";
import { userStartStop } from "./handlers/user-start-stop";
import { Context, Env, PluginInputs } from "./types";

export async function startStopTask(inputs: PluginInputs, env: Env) {
const octokit = new Octokit({ auth: inputs.authToken });
Expand Down
3 changes: 1 addition & 2 deletions src/worker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Value } from "@sinclair/typebox/value";
import { startStopTask } from "./plugin";
import { Env } from "./types/env";
import { startStopSchema, startStopSettingsValidator } from "./types/plugin-input";
import { Env, startStopSchema, startStopSettingsValidator } from "./types";

export default {
async fetch(request: Request, env: Env): Promise<Response> {
Expand Down
Loading

0 comments on commit 9f4d3e7

Please sign in to comment.