Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
"revert"
]
],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"header-max-length": [2, "always", 100],
"body-leading-blank": [1, "always"],
"body-max-line-length": [2, "always", 100],
"footer-leading-blank": [1, "always"],
"footer-max-line-length": [2, "always", 100]
}
}
11 changes: 0 additions & 11 deletions .github/copilot-instructions.md

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Commitlint
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
lint-fix:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- name: Install fabric
run: |
curl -fsSL https://raw.githubusercontent.com/danielmiessler/fabric/main/scripts/installer/install.sh | bash
- name: Lint PR squash commit (title + desc) and auto-fix with fabric if needed
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_BASE_URL: "https://api.openai.com/v1"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
set -e
mkdir -p "$HOME/.config/fabric"
touch "$HOME/.config/fabric/.env"
fabric -U
# Lint the squash commit (title + desc)
echo -e "${{ github.event.pull_request.title }}\n\n${{ github.event.pull_request.body }}" | npx -y commitlint && exit 0
# Summarize each commit's diff and append to a temporary file
TMP_CHANGELOG=$(mktemp)
COMMITS=$(git rev-list --reverse origin/main..HEAD)
for COMMIT in $COMMITS; do
echo "Summarizing $COMMIT..."
git show $COMMIT --no-patch --format="%h %s" >> "$TMP_CHANGELOG"
git --no-pager diff $COMMIT^ $COMMIT | fabric -m gpt-4o-mini -p summarize_git_diff >> "$TMP_CHANGELOG"
echo -e "\n---\n" >> "$TMP_CHANGELOG"
done
NEW_BODY=$(cat "$TMP_CHANGELOG" | fabric -m gpt-4o-mini -u https://www.conventionalcommits.org/en/v1.0.0/#summary "write a pull request description. start with a summary of key changes emphasising important factors of convential commits (fix, feat, chore, BREAKING CHANGE, etc). followed by followed by a changelog of commits. based on the following commits (dont add comentary as it will be directly used in the pr):")
PR_COMMITS=$(gh pr view $PR_NUMBER --json commits | jq -r '.commits[] | "\(.messageHeadline): \(.messageBody)"' | paste -sd ", " -)
NEW_TITLE=$(fabric -m gpt-4o-mini "write a conventional commits compatible title for a PR with the following commits and PR description: $PR_COMMITS; $NEW_BODY")
rm -f "$TMP_CHANGELOG"
gh pr edit $PR_NUMBER --title "$NEW_TITLE" --body "$NEW_BODY"
70 changes: 70 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Publish to npm

on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Run tests
run: npm test || echo "No tests configured yet"

release:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
permissions:
contents: write
issues: write
pull-requests: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Copy patterns to dist
run: npm run copy-patterns

- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
65 changes: 65 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Test

on:
pull_request:
branches:
- main
- develop
push:
branches:
- develop

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Run tests
run: npm test || echo "No tests configured yet"

- name: Lint code
run: npm run lint || echo "Linting not configured"

build-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build CLI
run: npm run build:cli

- name: Build Extension
run: npm run build:extension

- name: Verify dist files
run: |
test -f dist/cli/index.js || exit 1
test -f dist/extension/extension.js || exit 1
echo "✅ All build artifacts created successfully"
143 changes: 0 additions & 143 deletions .github/workflows/writecommit-ci-cd.yml

This file was deleted.

Loading
Loading