Skip to content

Commit 33db4f9

Browse files
authored
feat: add github actions (#1)
* feat: add github actions
1 parent 77bb022 commit 33db4f9

File tree

7 files changed

+70
-87
lines changed

7 files changed

+70
-87
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
version: 2
22
updates:
3-
# Enable version updates for npm
4-
- package-ecosystem: 'npm'
5-
directory: '/'
6-
schedule:
7-
interval: 'weekly'
8-
open-pull-requests-limit: 10
9-
versioning-strategy: auto
10-
11-
# Enable version updates for GitHub Actions
12-
- package-ecosystem: 'github-actions'
13-
directory: '/'
14-
schedule:
15-
interval: 'weekly'
16-
open-pull-requests-limit: 10
3+
# Enable version updates for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 10

.github/workflows/ci.yml

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,21 @@
1-
# name: CI
2-
3-
# on:
4-
# pull_request:
5-
# types: [opened, synchronize, reopened]
6-
7-
# jobs:
8-
# lint-and-test:
9-
# runs-on: ubuntu-latest
10-
11-
# steps:
12-
# - uses: actions/checkout@v4
13-
# with:
14-
# fetch-depth: 0
15-
16-
# - name: Setup Node.js
17-
# uses: actions/setup-node@v4
18-
# with:
19-
# node-version: '22'
20-
# cache: 'npm'
21-
22-
# - name: Install dependencies
23-
# run: npm install
24-
25-
# - name: Set up Python
26-
# uses: actions/setup-python@v5
27-
# with:
28-
# python-version: '3.x'
29-
# cache: 'pip'
30-
31-
# - name: Run pre-commit
32-
# run: pip install pre-commit && pre-commit run --all-files
33-
34-
# - name: Run tests
35-
# run: make test
1+
name: Pre-Commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
13+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 #v5.6.0
14+
with:
15+
python-version: "3.x"
16+
- name: Install shfmt and shellcheck
17+
if: steps.apt-cache.outputs.cache-hit != 'true'
18+
run: sudo apt-get update && sudo apt-get install -y shellcheck shfmt
19+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1
20+
with:
21+
extra_args: --all-files
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Semantic Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
types: [opened, edited, synchronize, reopened]
7+
8+
permissions:
9+
pull-requests: read
10+
11+
jobs:
12+
semantic-pull-request:
13+
name: semantic-pull-request
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
17+
name: Validate PR title
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2025-present Wisaroot Lertthaweedech
4+
5+
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:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
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.

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
hi:
1+
setup_dev:
22
chmod +x common/update_brew.sh
33
./common/update_brew.sh
44

@@ -8,8 +8,10 @@ hi:
88
pipx install pre-commit
99
pre-commit install
1010

11-
brew install shfmt
12-
brew install shellcheck
11+
brew install shfmt shellcheck
12+
13+
assert_setup_dev:
14+
pre-commit run -a
1315

1416
lint:
1517
find . -type f -name "*.sh" -exec shfmt -w -i 6 {} +

README.md

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,16 @@
1-
# About this template
1+
# Shared Scripts
22

3-
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.
3+
Collection of development setup and utility scripts for macOS environments.
44

5-
## Dependency
6-
7-
- [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
8-
- [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
9-
- [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
10-
- [.dockerignore](https://shisho.dev/blog/posts/how-to-use-dockerignore/) - in case you using docker container ignore non-nessessory file copy to your container
11-
- [.gitignore](https://github.com/github/gitignore) - help to ignore file or folder you don't need to commit to remote repository
12-
- [pre-commit](https://pre-commit.com/) - help to automate checking depend on plugin you are using for make sure everything is ok before commit
13-
14-
## Pre-commit Guideline
15-
16-
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
17-
18-
### Pre-commit will effect locally before commit after you install it
19-
20-
install pre-commit at local have 2 methods
21-
22-
Via Home Brew
23-
24-
```bash
25-
brew install pre-commit
26-
```
27-
28-
Via Pip
5+
## Quick Start
296

307
```bash
31-
pip install pre-commit
8+
make setup_dev # Install all dependencies and setup development environment
9+
make assert_setup_dev # Validate setup
3210
```
3311

34-
After iinstall successfully going to root of reposity (same path as `.pre-commit-config.yaml`)
35-
36-
Run below will install all plugins that specific in the file
37-
38-
```bash
39-
pre-commit install
40-
```
12+
## Requirements
4113

42-
Now every are set let `commit`. Readmore [here](https://pre-commit.com/)
14+
- macOS
15+
- Homebrew
16+
- Zsh shell

python/setup_pipx.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
set -e
44

55
brew install pipx
6+
pipx upgrade-all
67
pipx ensurepath

0 commit comments

Comments
 (0)