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
20 changes: 6 additions & 14 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
open-pull-requests-limit: 10
versioning-strategy: auto

# Enable version updates for GitHub Actions
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
open-pull-requests-limit: 10
# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
56 changes: 21 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
# name: CI

# on:
# pull_request:
# types: [opened, synchronize, reopened]

# jobs:
# lint-and-test:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0

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

# - name: Install dependencies
# run: npm install

# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.x'
# cache: 'pip'

# - name: Run pre-commit
# run: pip install pre-commit && pre-commit run --all-files

# - name: Run tests
# run: make test
name: Pre-Commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5.6.0
with:
python-version: "3.x"
- name: Install shfmt and shellcheck
if: steps.apt-cache.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo apt-get install -y shellcheck shfmt
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1
with:
extra_args: --all-files
19 changes: 19 additions & 0 deletions .github/workflows/semantic-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Semantic Pull Request

on:
pull_request:
branches: [main]
types: [opened, edited, synchronize, reopened]

permissions:
pull-requests: read

jobs:
semantic-pull-request:
name: semantic-pull-request
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
name: Validate PR title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2025-present Wisaroot Lertthaweedech

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hi:
setup_dev:
chmod +x common/update_brew.sh
./common/update_brew.sh

Expand All @@ -8,8 +8,10 @@ hi:
pipx install pre-commit
pre-commit install

brew install shfmt
brew install shellcheck
brew install shfmt shellcheck

assert_setup_dev:
pre-commit run -a

lint:
find . -type f -name "*.sh" -exec shfmt -w -i 6 {} +
Expand Down
44 changes: 9 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,16 @@
# About this template
# Shared Scripts

This template provided common nice to have for every projects under Abacus Digital please feel free to add, edit or delete if you do not using it.
Collection of development setup and utility scripts for macOS environments.

## Dependency

- [CODEOWNERS](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) - help controlling whether person or team are owner this repository and permission to approved the pull request
- [dependabot.yaml](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file) - help auto update the dependency you are using with, also check the dependency CVE
- [pullrequest_template](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository) - help create template format for every one would like to open pull-request to your repository must following the guideline format
- [.dockerignore](https://shisho.dev/blog/posts/how-to-use-dockerignore/) - in case you using docker container ignore non-nessessory file copy to your container
- [.gitignore](https://github.com/github/gitignore) - help to ignore file or folder you don't need to commit to remote repository
- [pre-commit](https://pre-commit.com/) - help to automate checking depend on plugin you are using for make sure everything is ok before commit

## Pre-commit Guideline

Pre-commit is a powerful tool that can help you ensure everyone has followed the common practice or linter guidelines you are setting up. It also has other tools to help you, like [Husky](https://typicode.github.io/husky/) Anyway, feel free to remove it if it doesn't match your context

### Pre-commit will effect locally before commit after you install it

install pre-commit at local have 2 methods

Via Home Brew

```bash
brew install pre-commit
```

Via Pip
## Quick Start

```bash
pip install pre-commit
make setup_dev # Install all dependencies and setup development environment
make assert_setup_dev # Validate setup
```

After iinstall successfully going to root of reposity (same path as `.pre-commit-config.yaml`)

Run below will install all plugins that specific in the file

```bash
pre-commit install
```
## Requirements

Now every are set let `commit`. Readmore [here](https://pre-commit.com/)
- macOS
- Homebrew
- Zsh shell
1 change: 1 addition & 0 deletions python/setup_pipx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
set -e

brew install pipx
pipx upgrade-all
pipx ensurepath