Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng authored Nov 4, 2024
0 parents commit 6ef6c58
Show file tree
Hide file tree
Showing 51 changed files with 8,174 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "./src/adapters/supabase/**/**.ts"],
"useGitignore": true,
"language": "en",
"words": [
"Nektos",
"dataurl",
"devpool",
"outdir",
"servedir",
"Supabase",
"SUPABASE",
"typebox",
"ubiquibot",
"Smee",
"typeguards",
"mswjs",
"Typeguards",
"sonarjs",
"knip",
"mischeck"
],
"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}"]
}
1 change: 1 addition & 0 deletions .dev.vars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MY_SECRET="MY_SECRET"
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MY_SECRET="MY_SECRET"
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

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: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**"],
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: 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
-->
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-22.04

steps:
- name: Check out repository
uses: actions/checkout@v4

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

- name: Build
run: |
yarn
yarn build
46 changes: 46 additions & 0 deletions .github/workflows/compute.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "the name of the plugin"

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"
signature:
description: "The kernel signature"

jobs:
compute:
name: "plugin name"
runs-on: ubuntu-latest
permissions: write-all
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}

steps:
- uses: actions/checkout@v4

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

- name: install dependencies
run: yarn

- name: execute directive
run: npx tsx ./src/main.ts
id: plugin-name
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
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@v3
- uses: ubiquity/action-conventional-commits@master
23 changes: 23 additions & 0 deletions .github/workflows/formatting-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Formatting Check

on:
push:

jobs:
spellcheck:
name: Check for formatting 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: Run formatting checks
run: |
yarn install
yarn check-formatting
27 changes: 27 additions & 0 deletions .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run Jest testing suite
on:
workflow_dispatch:
pull_request:

env:
NODE_ENV: "test"

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
run: yarn install --immutable --immutable-cache --check-cache && yarn test

- name: Add Jest Report to Summary
if: always()
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 }}
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
58 changes: 58 additions & 0 deletions .github/workflows/update-configuration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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: |
const fs = require('fs');
const path = require('path');
const { pluginSettingsSchema } = require('./src/types');
const manifestPath = path.resolve("${{ github.workspace }}", './manifest.json');
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
const configuration = JSON.stringify(pluginSettingsSchema);
manifest["configuration"] = JSON.parse(configuration);
const updatedManifest = JSON.stringify(manifest, null, 2)
console.log('Updated manifest:', updatedManifest);
fs.writeFileSync(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 }}
44 changes: 44 additions & 0 deletions .github/workflows/worker-delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Delete Deployment

on:
delete:

jobs:
delete:
runs-on: ubuntu-latest
name: Delete Deployment
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- name: Enable corepack
run: corepack enable

- uses: actions/checkout@v4

- name: Get Deleted Branch Name
id: get_branch
run: |
branch_name=$(echo '${{ github.event.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g')
echo "branch_name=$branch_name" >> $GITHUB_ENV
- name: Retrieve and Construct Full Worker Name
id: construct_worker_name
run: |
base_name=$(grep '^name = ' wrangler.toml | head -n 1 | sed 's/^name = "\(.*\)"$/\1/')
full_worker_name="${base_name}-${{ env.branch_name }}"
# Make sure that it doesnt exceed 63 characters or it will break RFC 1035
full_worker_name=$(echo "${full_worker_name}" | cut -c 1-63)
echo "full_worker_name=$full_worker_name" >> $GITHUB_ENV
- name: Delete Deployment with Wrangler
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: delete --name ${{ env.full_worker_name }}

- name: Output Deletion Result
run: |
echo "### Deployment URL" >> $GITHUB_STEP_SUMMARY
echo 'Deployment `${{ env.full_worker_name }}` has been deleted.' >> $GITHUB_STEP_SUMMARY
Loading

0 comments on commit 6ef6c58

Please sign in to comment.