Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["local>sparetimecoders/renovate-config"]
}
3 changes: 3 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
titleOnly: true
# Disallows use of Merge commits
allowMergeCommits: false
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read
packages: read

jobs:
test:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
- name: Configure registry
run: |
cat > bunfig.toml << 'TOML'
[install.scopes]
"@sparetimecoders" = { token = "${{ secrets.GITHUB_TOKEN }}", url = "https://npm.pkg.github.com" }
TOML
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: bun run typecheck
- name: Test
run: bun test --coverage --coverage-reporter=lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
files: ./coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build
run: bun run build
16 changes: 16 additions & 0 deletions .github/workflows/enable_pr_automerge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Enable Auto merge PR
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
enable_automerge:
runs-on: ubuntu-latest
steps:
- name: Enable auto-merge for PRs
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.PR_GITHUB_TOKEN}}
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches: [main]

permissions:
contents: write
pull-requests: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: ${{ steps.release.outputs.release_created }}
with:
persist-credentials: false

- uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
if: ${{ steps.release.outputs.release_created }}

- name: Install and build
if: ${{ steps.release.outputs.release_created }}
run: |
cat > bunfig.toml << 'TOML'
[install.scopes]
"@sparetimecoders" = { token = "${{ secrets.GITHUB_TOKEN }}", url = "https://npm.pkg.github.com" }
TOML
bun install --frozen-lockfile
bun run build

- name: Publish # zizmor: ignore[use-trusted-publishing]
if: ${{ steps.release.outputs.release_created }}
run: bun publish --registry https://npm.pkg.github.com
env:
BUN_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/review-gate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Review Gate

on:
pull_request:
types: [opened, synchronize, reopened]
pull_request_review:
types: [submitted]

permissions: {}

jobs:
review-gate:
name: Review Gate
runs-on: ubuntu-latest
steps:
- name: Check if review is required
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
if [ "$PR_AUTHOR" = "peter-svensson" ] || [ "$PR_AUTHOR" = "github-actions[bot]" ]; then
echo "PR by $PR_AUTHOR, no review required"
exit 0
fi

APPROVED=$(gh api "repos/${REPO}/pulls/${PR_NUMBER}/reviews" --jq '[.[] | select(.state == "APPROVED")] | length')
if [ "$APPROVED" -lt 1 ]; then
echo "::error::PRs by $PR_AUTHOR require at least one approving review"
exit 1
fi

echo "PR by $PR_AUTHOR approved, review gate passed"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
dist/
bunfig.toml
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

57 changes: 57 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading