Skip to content

Commit

Permalink
feat: add formatters (#26)
Browse files Browse the repository at this point in the history
Co-authored-by: Almanov Nikita <[email protected]>
  • Loading branch information
github-actions[bot] and nikkeyl authored Aug 13, 2024
1 parent 668e3a3 commit a61bfd0
Show file tree
Hide file tree
Showing 15 changed files with 205 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .ecrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exclude": [
"README.md"
]
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @nikkeyl
15 changes: 15 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: sunday

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: sunday
versioning-strategy: increase
38 changes: 38 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Commit Lint

on:
push:

jobs:
commit-lint:
name: Commit Lint

if: ${{ github.actor != 'dependabot[bot]' }}

runs-on: ubuntu-latest
timeout-minutes: 10

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

- name: Set Up BunJS
uses: oven-sh/setup-bun@v2

- name: Install Dependencies
run: bun i

- name: Extract Commit Message (Push)
if: ${{ github.event_name }} == 'push'
run: |
git log -1 --pretty=%B > commit_message.txt
- name: Extract Commit Message (Pull Request)
if: ${{ github.event_name }} == 'pull_request'
run: |
git show -s --format=%B > commit_message.txt
- name: Lint
run: |
COMMIT_MESSAGE=$(cat commit_message.txt)
echo "$COMMIT_MESSAGE" | bun commitlint
21 changes: 21 additions & 0 deletions .github/workflows/create-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create Pull Request

on:
push:

jobs:
create-pull-request:
name: Create Pull Request

if: ${{ github.actor != 'dependabot[bot]' }}

runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_BRANCH: main
PULL_REQUEST_TITLE: ${{ github.event.head_commit.message }}
uses: vsoch/pull-request-action@master
29 changes: 29 additions & 0 deletions .github/workflows/editorconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Editorconfig

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

jobs:
editorconfig:
name: Editorconfig

runs-on: ubuntu-latest
timeout-minutes: 10

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

- name: Set Up BunJS
uses: oven-sh/setup-bun@v2

- name: Install Dependencies
run: bun i

- name: Lint
run: bun lint:editorconfig
33 changes: 33 additions & 0 deletions .github/workflows/remark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Remark

on:
pull_request:
branches:
- main
paths:
- '**/*.md'
push:
branches:
- main
paths:
- '**/*.md'

jobs:
remark:
name: Remark

runs-on: ubuntu-latest
timeout-minutes: 10

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

- name: Set Up BunJS
uses: oven-sh/setup-bun@v2

- name: Install Dependencies
run: bun i

- name: Lint
run: bun lint:md
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Bun
bun.lockb

# Directories
node_modules
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bun commitlint --edit
1 change: 1 addition & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bun git-pull-run --pattern 'package.json' --command 'bun i'
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bun lint-staged
7 changes: 7 additions & 0 deletions .remarkrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"plugins": [
"remark-preset-lint-consistent",
"remark-preset-lint-markdown-style-guide",
"remark-preset-lint-recommended"
]
}
24 changes: 24 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { defineConfig } from '@archoleat/commitlint-define-config';

export default defineConfig({
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'spec',
'style',
],
],
},
});
3 changes: 3 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
'**/*.md': 'remark --quiet --frail'
};
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"scripts": {
"lint:editorconfig": "editorconfig-checker",
"lint:md": "remark . --quiet --frail"
},
"devDependencies": {
"@archoleat/commitlint-define-config": "^1.0.9",
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"@commitlint/types": "^19.0.3",
"editorconfig-checker": "^5.1.8",
"git-pull-run": "^1.4.0",
"husky": "^9.1.4",
"lint-staged": "^15.2.9",
"remark": "15.0.1",
"remark-cli": "^12.0.1",
"remark-preset-lint-consistent": "^6.0.0",
"remark-preset-lint-markdown-style-guide": "^6.0.0",
"remark-preset-lint-recommended": "^7.0.0"
}
}

0 comments on commit a61bfd0

Please sign in to comment.