From f5daefc7ecc085e0bf0f76018fd4c2ab81124db9 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:20:00 +0700 Subject: [PATCH 01/36] feat: create individual actions --- .github/workflows/commit-check.yml | 48 ++++++++++++++++++++++++++++ .github/workflows/markdown-check.yml | 19 +++++++++++ .github/workflows/prettier.yml | 44 +++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 .github/workflows/commit-check.yml create mode 100644 .github/workflows/markdown-check.yml create mode 100644 .github/workflows/prettier.yml diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml new file mode 100644 index 0000000..8c0f64a --- /dev/null +++ b/.github/workflows/commit-check.yml @@ -0,0 +1,48 @@ +name: Conventional Commit Check + +on: + workflow_call: + +jobs: + commit-check: + 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' + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Install commitlint + run: pnpm add -g @commitlint/cli @commitlint/config-conventional + + - name: Create commitlint config if missing + run: | + if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' package.json 2>/dev/null; then + echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json + fi + + - name: Check PR title + if: github.event_name == 'pull_request' + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + echo "$PR_TITLE" | commitlint + + - name: Check commit messages + if: github.event_name == 'pull_request' + run: | + set -e + BASE_SHA="${{ github.event.pull_request.base.sha }}" + HEAD_SHA="${{ github.event.pull_request.head.sha }}" + while IFS= read -r commit_msg; do + echo "$commit_msg" | commitlint + done < <(git log --format=%s "$BASE_SHA..$HEAD_SHA") diff --git a/.github/workflows/markdown-check.yml b/.github/workflows/markdown-check.yml new file mode 100644 index 0000000..565b2b9 --- /dev/null +++ b/.github/workflows/markdown-check.yml @@ -0,0 +1,19 @@ +name: Markdown Lint + +on: + workflow_call: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install rumdl pre-compiled binary + run: | + DOWNLOAD_URL="https://github.com/rvben/rumdl/releases/download/v0.0.185/rumdl-v0.0.185-x86_64-unknown-linux-gnu.tar.gz" + curl -sL $DOWNLOAD_URL | tar -xz -C /usr/local/bin/ + chmod +x /usr/local/bin/rumdl + + - name: Lint Markdown + run: rumdl check --output-format github . diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 0000000..de7cb66 --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,44 @@ +name: Prettier Check + +on: + workflow_call: + +jobs: + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check for Prettier config + run: | + CONFIG_FILES=".prettierrc .prettierrc.json .prettierrc.js .prettierrc.yaml .prettierrc.yml .prettierrc.toml prettier.config.js prettier.config.mjs" + HAS_CONFIG=false + + for file in $CONFIG_FILES; do + if [ -f "$file" ]; then + HAS_CONFIG=true + break + fi + done + + if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' package.json 2>/dev/null; then + echo "::error file=.prettierrc::No Prettier configuration file found." + echo "Please create a .prettierrc file or add prettier config to package.json" + exit 1 + fi + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Install Prettier + run: pnpm add -g prettier + + - name: Check formatting + run: prettier --check . From 388958f80482cce8e63a528531412877bf7352d4 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:20:07 +0700 Subject: [PATCH 02/36] feat: create single action aggregator --- .github/workflows/pr-checks.yml | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/pr-checks.yml diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..55d7d4c --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,49 @@ +name: PR Checks + +on: + workflow_call: + inputs: + run-prettier: + description: 'Run Prettier check' + required: false + type: boolean + default: true + run-markdown: + description: 'Run Markdown check' + required: false + type: boolean + default: true + run-commits: + description: 'Run Commit check' + required: false + type: boolean + default: true + +jobs: + check-draft: + runs-on: ubuntu-latest + outputs: + should-run: ${{ steps.check.outputs.should-run }} + steps: + - id: check + run: | + if [ "${{ github.event_name }}" != "pull_request" ] || [ "${{ github.event.pull_request.draft }}" != "true" ]; then + echo "should-run=true" >> $GITHUB_OUTPUT + else + echo "should-run=false" >> $GITHUB_OUTPUT + fi + + prettier: + needs: check-draft + if: needs.check-draft.outputs.should-run == 'true' && inputs.run-prettier != false + uses: ${{ github.repository }}/.github/workflows/prettier.yml@${{ github.ref }} + + markdown: + needs: check-draft + if: needs.check-draft.outputs.should-run == 'true' && inputs.run-markdown != false + uses: ${{ github.repository }}/.github/workflows/markdown-check.yml@${{ github.ref }} + + commits: + needs: check-draft + if: needs.check-draft.outputs.should-run == 'true' && inputs.run-commits != false + uses: ${{ github.repository }}/.github/workflows/commit-check.yml@${{ github.ref }} From 9e1be5ee90edba9c19bf0d70c7b7204ecf9e716d Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:22:18 +0700 Subject: [PATCH 03/36] fix: use hardcoded repo name --- .github/workflows/pr-checks.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 55d7d4c..6f134ea 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -36,14 +36,14 @@ jobs: prettier: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && inputs.run-prettier != false - uses: ${{ github.repository }}/.github/workflows/prettier.yml@${{ github.ref }} + uses: holdex/github-actions/.github/workflows/prettier.yml@main markdown: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && inputs.run-markdown != false - uses: ${{ github.repository }}/.github/workflows/markdown-check.yml@${{ github.ref }} + uses: holdex/github-actions/.github/workflows/markdown-check.yml@main commits: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && inputs.run-commits != false - uses: ${{ github.repository }}/.github/workflows/commit-check.yml@${{ github.ref }} + uses: holdex/github-actions/.github/workflows/commit-check.yml@main From 6b47acd061bee605c0042780149d09dfbb5a8a09 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:26:45 +0700 Subject: [PATCH 04/36] feat: call pr checks on push --- .github/workflows/pr-checks.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 6f134ea..869b313 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -1,6 +1,8 @@ name: PR Checks on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] workflow_call: inputs: run-prettier: @@ -35,15 +37,15 @@ jobs: prettier: needs: check-draft - if: needs.check-draft.outputs.should-run == 'true' && inputs.run-prettier != false + if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != false || github.event_name != 'workflow_call') uses: holdex/github-actions/.github/workflows/prettier.yml@main markdown: needs: check-draft - if: needs.check-draft.outputs.should-run == 'true' && inputs.run-markdown != false + if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-markdown != false || github.event_name != 'workflow_call') uses: holdex/github-actions/.github/workflows/markdown-check.yml@main commits: needs: check-draft - if: needs.check-draft.outputs.should-run == 'true' && inputs.run-commits != false + if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits != false || github.event_name != 'workflow_call') uses: holdex/github-actions/.github/workflows/commit-check.yml@main From 497409bd224f74009c61740a6a44f6acf0da8c05 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:30:20 +0700 Subject: [PATCH 05/36] refactor: use relative path --- .github/workflows/pr-checks.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 869b313..09b7734 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -38,14 +38,14 @@ jobs: prettier: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != false || github.event_name != 'workflow_call') - uses: holdex/github-actions/.github/workflows/prettier.yml@main + uses: ./.github/workflows/prettier.yml@main markdown: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-markdown != false || github.event_name != 'workflow_call') - uses: holdex/github-actions/.github/workflows/markdown-check.yml@main + uses: ./.github/workflows/markdown-check.yml@main commits: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits != false || github.event_name != 'workflow_call') - uses: holdex/github-actions/.github/workflows/commit-check.yml@main + uses: ./.github/workflows/commit-check.yml@main From e6340753b09e9de43e99d1002ca444fa75c4c612 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:30:52 +0700 Subject: [PATCH 06/36] chore: remove version pinning on local workflow --- .github/workflows/pr-checks.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 09b7734..80889f0 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -38,14 +38,14 @@ jobs: prettier: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != false || github.event_name != 'workflow_call') - uses: ./.github/workflows/prettier.yml@main + uses: ./.github/workflows/prettier.yml markdown: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-markdown != false || github.event_name != 'workflow_call') - uses: ./.github/workflows/markdown-check.yml@main + uses: ./.github/workflows/markdown-check.yml commits: needs: check-draft if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits != false || github.event_name != 'workflow_call') - uses: ./.github/workflows/commit-check.yml@main + uses: ./.github/workflows/commit-check.yml From 00c58a493ef4b0c4b537cb80960cf32511b88b63 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:37:36 +0700 Subject: [PATCH 07/36] fix: install config conventional locally --- .github/workflows/commit-check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 8c0f64a..32dc7d5 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -22,7 +22,9 @@ jobs: version: 9 - name: Install commitlint - run: pnpm add -g @commitlint/cli @commitlint/config-conventional + run: | + pnpm add -g @commitlint/cli + pnpm add -D @commitlint/config-conventional - name: Create commitlint config if missing run: | From 64c0c30f174ac6398f41b3bd71a772aa2dbe9e16 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:37:49 +0700 Subject: [PATCH 08/36] chore: not run prettier check on this repo --- .github/workflows/pr-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 80889f0..8725ad2 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -37,7 +37,7 @@ jobs: prettier: needs: check-draft - if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != false || github.event_name != 'workflow_call') + if: needs.check-draft.outputs.should-run == 'true' && inputs.run-prettier != false uses: ./.github/workflows/prettier.yml markdown: From 96b685016df7110498646005e8a77be32e7dc2b0 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:42:41 +0700 Subject: [PATCH 09/36] feat: add checksum check --- .github/workflows/markdown-check.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/markdown-check.yml b/.github/workflows/markdown-check.yml index 565b2b9..95f2147 100644 --- a/.github/workflows/markdown-check.yml +++ b/.github/workflows/markdown-check.yml @@ -10,9 +10,13 @@ jobs: - uses: actions/checkout@v4 - name: Install rumdl pre-compiled binary + # EXPECTED_SHA256 is obtained from `curl -sL $DOWNLOAD_URL | sha256sum` run: | DOWNLOAD_URL="https://github.com/rvben/rumdl/releases/download/v0.0.185/rumdl-v0.0.185-x86_64-unknown-linux-gnu.tar.gz" - curl -sL $DOWNLOAD_URL | tar -xz -C /usr/local/bin/ + EXPECTED_SHA256="5e6f28fa4935fb7d022c4f2d64f82b12206038d17e6570466afe7d7a3b135fba" + curl -sL $DOWNLOAD_URL -o /tmp/rumdl.tar.gz + echo "$EXPECTED_SHA256 /tmp/rumdl.tar.gz" | sha256sum -c - + tar -xzf /tmp/rumdl.tar.gz -C /usr/local/bin/ chmod +x /usr/local/bin/rumdl - name: Lint Markdown From 0f97192fa16a6596c69469561cf9fc3058266926 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:50:55 +0700 Subject: [PATCH 10/36] docs: add readme --- README.md | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 61ad4e5..3ad6941 100644 --- a/README.md +++ b/README.md @@ -1 +1,149 @@ -# Github Actions +# GitHub Actions + +Shared GitHub Actions workflows for consistent code quality checks across repositories. + +## Available Workflows + +This repository provides reusable workflows for: + +- **Prettier Check** - Validates code formatting with Prettier +- **Markdown Lint** - Lints Markdown files using rumdl +- **Conventional Commit Check** - Validates commit messages follow conventional commit format +- **PR Checks** - Combined workflow that runs all checks (or selected ones) with draft PR handling + +## Usage + +### Option 1: Combined Workflow (Recommended for Simple Setup) + +Use the combined `pr-checks.yml` workflow to run all checks at once. This workflow automatically handles draft PRs and runs all checks by default. + +#### Basic Usage + +Create `.github/workflows/pr-checks.yml` in your repository: + +```yaml +name: PR Checks + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +jobs: + checks: + uses: holdex/github-actions/.github/workflows/pr-checks.yml@main +``` + +#### Selective Checks + +To run only specific checks, pass input flags: + +```yaml +name: PR Checks + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +jobs: + checks: + uses: holdex/github-actions/.github/workflows/pr-checks.yml@main + with: + run-prettier: true + run-markdown: false # Skip markdown check + run-commits: true +``` + +### Option 2: Individual Workflows + +Use individual workflows for granular control over when each check runs. + +#### Prettier Check + +```yaml +name: Prettier Check + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + prettier: + uses: holdex/github-actions/.github/workflows/prettier.yml@main +``` + +**Requirements:** + +- Prettier configuration file (`.prettierrc`, `.prettierrc.json`, etc.) or `prettier` config in `package.json` + +#### Markdown Lint + +```yaml +name: Markdown Lint + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + markdown: + uses: holdex/github-actions/.github/workflows/markdown-check.yml@main +``` + +#### Conventional Commit Check + +```yaml +name: Commit Check + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + commits: + uses: holdex/github-actions/.github/workflows/commit-check.yml@main +``` + +**Requirements:** + +- Commitlint configuration file (`.commitlintrc.json`, etc.) or `commitlint` config in `package.json` +- If no config exists, the workflow will create a default `.commitlintrc.json` file +- `package.json` is required because the workflow installs `@commitlint/config-conventional` as a dev dependency + +## Workflow Details + +### PR Checks (`pr-checks.yml`) + +The combined workflow includes: + +- **Draft PR handling** - Automatically skips checks for draft PRs +- **Selective execution** - Control which checks run via inputs +- **Default behavior** - Runs all checks if no inputs specified + +**Inputs:** + +- `run-prettier` (boolean, default: `true`) - Run Prettier check +- `run-markdown` (boolean, default: `true`) - Run Markdown lint +- `run-commits` (boolean, default: `true`) - Run commit check + +### Prettier Check (`prettier.yml`) + +- Validates that a Prettier configuration exists +- Checks code formatting using Prettier +- Supports all Prettier-supported file types + +### Markdown Lint (`markdown-check.yml`) + +- Uses `rumdl` v0.0.185 for fast Markdown linting +- Checks all Markdown files in the repository +- Reports issues with GitHub annotations + +### Conventional Commit Check (`commit-check.yml`) + +- Validates PR titles follow conventional commit format +- Validates all commit messages in the PR +- Creates default commitlint config if missing (requires `package.json`) + +## Requirements + +- Node.js 22+ +- pnpm (installed automatically in workflows) From 1ff46b8e39457329db46603b809aaca86244cca1 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Mon, 22 Dec 2025 23:56:51 +0700 Subject: [PATCH 11/36] chore: run prettier check here --- .github/workflows/pr-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 8725ad2..80889f0 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -37,7 +37,7 @@ jobs: prettier: needs: check-draft - if: needs.check-draft.outputs.should-run == 'true' && inputs.run-prettier != false + if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != false || github.event_name != 'workflow_call') uses: ./.github/workflows/prettier.yml markdown: From be8820a9d97b43c9d19e407f7fb0618344483e78 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:06:13 +0700 Subject: [PATCH 12/36] feat: add prettier in this repo for development --- .github/workflows/commit-check.yml | 2 +- .github/workflows/pr-checks.yml | 18 ++++++++++++------ .github/workflows/prettier.yml | 2 +- .gitignore | 1 + .prettierignore | 1 + .prettierrc | 5 +++++ README.md | 24 ++++++++++++++++-------- package.json | 17 +++++++++++++++++ pnpm-lock.yaml | 24 ++++++++++++++++++++++++ 9 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 .gitignore create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 package.json create mode 100644 pnpm-lock.yaml diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 32dc7d5..48b3a1c 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -14,7 +14,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22' + node-version: "22" - name: Setup pnpm uses: pnpm/action-setup@v4 diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 80889f0..3b92e3e 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -6,17 +6,17 @@ on: workflow_call: inputs: run-prettier: - description: 'Run Prettier check' + description: "Run Prettier check" required: false type: boolean default: true run-markdown: - description: 'Run Markdown check' + description: "Run Markdown check" required: false type: boolean default: true run-commits: - description: 'Run Commit check' + description: "Run Commit check" required: false type: boolean default: true @@ -37,15 +37,21 @@ jobs: prettier: needs: check-draft - if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != false || github.event_name != 'workflow_call') + if: + needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != + false || github.event_name != 'workflow_call') uses: ./.github/workflows/prettier.yml markdown: needs: check-draft - if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-markdown != false || github.event_name != 'workflow_call') + if: + needs.check-draft.outputs.should-run == 'true' && (inputs.run-markdown != + false || github.event_name != 'workflow_call') uses: ./.github/workflows/markdown-check.yml commits: needs: check-draft - if: needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits != false || github.event_name != 'workflow_call') + if: + needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits != + false || github.event_name != 'workflow_call') uses: ./.github/workflows/commit-check.yml diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index de7cb66..bf3c280 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22' + node-version: "22" - name: Setup pnpm uses: pnpm/action-setup@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..bd5535a --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +pnpm-lock.yaml diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..574245f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "printWidth": 80, + "proseWrap": "always", + "singleQuote": false +} diff --git a/README.md b/README.md index 3ad6941..e18f9c8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # GitHub Actions -Shared GitHub Actions workflows for consistent code quality checks across repositories. +Shared GitHub Actions workflows for consistent code quality checks across +repositories. ## Available Workflows @@ -8,14 +9,17 @@ This repository provides reusable workflows for: - **Prettier Check** - Validates code formatting with Prettier - **Markdown Lint** - Lints Markdown files using rumdl -- **Conventional Commit Check** - Validates commit messages follow conventional commit format -- **PR Checks** - Combined workflow that runs all checks (or selected ones) with draft PR handling +- **Conventional Commit Check** - Validates commit messages follow conventional + commit format +- **PR Checks** - Combined workflow that runs all checks (or selected ones) with + draft PR handling ## Usage ### Option 1: Combined Workflow (Recommended for Simple Setup) -Use the combined `pr-checks.yml` workflow to run all checks at once. This workflow automatically handles draft PRs and runs all checks by default. +Use the combined `pr-checks.yml` workflow to run all checks at once. This +workflow automatically handles draft PRs and runs all checks by default. #### Basic Usage @@ -73,7 +77,8 @@ jobs: **Requirements:** -- Prettier configuration file (`.prettierrc`, `.prettierrc.json`, etc.) or `prettier` config in `package.json` +- Prettier configuration file (`.prettierrc`, `.prettierrc.json`, etc.) or + `prettier` config in `package.json` #### Markdown Lint @@ -105,9 +110,12 @@ jobs: **Requirements:** -- Commitlint configuration file (`.commitlintrc.json`, etc.) or `commitlint` config in `package.json` -- If no config exists, the workflow will create a default `.commitlintrc.json` file -- `package.json` is required because the workflow installs `@commitlint/config-conventional` as a dev dependency +- Commitlint configuration file (`.commitlintrc.json`, etc.) or `commitlint` + config in `package.json` +- If no config exists, the workflow will create a default `.commitlintrc.json` + file +- `package.json` is required because the workflow installs + `@commitlint/config-conventional` as a dev dependency ## Workflow Details diff --git a/package.json b/package.json new file mode 100644 index 0000000..3bec792 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "github-actions", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "format": "prettier --write ." + }, + "keywords": [], + "author": "", + "license": "ISC", + "packageManager": "pnpm@10.7.0", + "devDependencies": { + "prettier": "^3.7.4" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..2a14c5e --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,24 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + prettier: + specifier: ^3.7.4 + version: 3.7.4 + +packages: + + prettier@3.7.4: + resolution: {integrity: sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==} + engines: {node: '>=14'} + hasBin: true + +snapshots: + + prettier@3.7.4: {} From bbc4c3961c692fc1776be256bf5303695d483fc4 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:09:58 +0700 Subject: [PATCH 13/36] chore: use pnpm 10 --- .github/workflows/commit-check.yml | 2 +- .github/workflows/prettier.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 48b3a1c..b5af97c 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -19,7 +19,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 9 + version: 10 - name: Install commitlint run: | diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index bf3c280..672f396 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -35,7 +35,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 9 + version: 10 - name: Install Prettier run: pnpm add -g prettier From 9655732b7f12660e60cb866897d1d579ce94efd7 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:16:10 +0700 Subject: [PATCH 14/36] feat: add package json path for version managing --- .github/workflows/commit-check.yml | 1 + .github/workflows/prettier.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index b5af97c..9ed2046 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -19,6 +19,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: + package_json_path: package.json version: 10 - name: Install commitlint diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 672f396..3e4b007 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -35,6 +35,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: + package_json_path: package.json version: 10 - name: Install Prettier From 50517cad5601fc8a84de59507d7001ca38532106 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:18:30 +0700 Subject: [PATCH 15/36] feat: add additional custom package json path --- .github/workflows/commit-check.yml | 10 ++++++++-- .github/workflows/pr-checks.yml | 9 +++++++++ .github/workflows/prettier.yml | 10 ++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 9ed2046..c39006a 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -2,6 +2,12 @@ name: Conventional Commit Check on: workflow_call: + inputs: + package_json_path: + description: "Path to package.json file" + required: false + type: string + default: "package.json" jobs: commit-check: @@ -19,7 +25,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_path: package.json + package_json_path: ${{ inputs.package_json_path }} version: 10 - name: Install commitlint @@ -29,7 +35,7 @@ jobs: - name: Create commitlint config if missing run: | - if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' package.json 2>/dev/null; then + if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ inputs.package_json_path }}" 2>/dev/null; then echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json fi diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 3b92e3e..7e04ce0 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -20,6 +20,11 @@ on: required: false type: boolean default: true + package_json_path: + description: "Path to package.json file" + required: false + type: string + default: "package.json" jobs: check-draft: @@ -41,6 +46,8 @@ jobs: needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != false || github.event_name != 'workflow_call') uses: ./.github/workflows/prettier.yml + with: + package_json_path: ${{ inputs.package_json_path }} markdown: needs: check-draft @@ -55,3 +62,5 @@ jobs: needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits != false || github.event_name != 'workflow_call') uses: ./.github/workflows/commit-check.yml + with: + package_json_path: ${{ inputs.package_json_path }} diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 3e4b007..85f9ae0 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -2,6 +2,12 @@ name: Prettier Check on: workflow_call: + inputs: + package_json_path: + description: "Path to package.json file" + required: false + type: string + default: "package.json" jobs: prettier: @@ -21,7 +27,7 @@ jobs: fi done - if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' package.json 2>/dev/null; then + if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ inputs.package_json_path }}" 2>/dev/null; then echo "::error file=.prettierrc::No Prettier configuration file found." echo "Please create a .prettierrc file or add prettier config to package.json" exit 1 @@ -35,7 +41,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_path: package.json + package_json_path: ${{ inputs.package_json_path }} version: 10 - name: Install Prettier From 971bed7506df3fce5bda753434433b9ed6721f0c Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:20:55 +0700 Subject: [PATCH 16/36] fix: remove version in pnpm action setup --- .github/workflows/commit-check.yml | 1 - .github/workflows/prettier.yml | 1 - README.md | 33 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index c39006a..71b9c03 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -26,7 +26,6 @@ jobs: uses: pnpm/action-setup@v4 with: package_json_path: ${{ inputs.package_json_path }} - version: 10 - name: Install commitlint run: | diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 85f9ae0..78236a6 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -42,7 +42,6 @@ jobs: uses: pnpm/action-setup@v4 with: package_json_path: ${{ inputs.package_json_path }} - version: 10 - name: Install Prettier run: pnpm add -g prettier diff --git a/README.md b/README.md index e18f9c8..698435d 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,18 @@ jobs: run-commits: true ``` +#### Custom package.json Path + +If your `package.json` is not in the repository root, specify the path: + +```yaml +jobs: + checks: + uses: holdex/github-actions/.github/workflows/pr-checks.yml@main + with: + package_json_path: "frontend/package.json" +``` + ### Option 2: Individual Workflows Use individual workflows for granular control over when each check runs. @@ -75,6 +87,11 @@ jobs: uses: holdex/github-actions/.github/workflows/prettier.yml@main ``` +**Inputs:** + +- `package_json_path` (string, default: `"package.json"`) - Path to package.json + file + **Requirements:** - Prettier configuration file (`.prettierrc`, `.prettierrc.json`, etc.) or @@ -108,6 +125,11 @@ jobs: uses: holdex/github-actions/.github/workflows/commit-check.yml@main ``` +**Inputs:** + +- `package_json_path` (string, default: `"package.json"`) - Path to package.json + file + **Requirements:** - Commitlint configuration file (`.commitlintrc.json`, etc.) or `commitlint` @@ -132,12 +154,16 @@ The combined workflow includes: - `run-prettier` (boolean, default: `true`) - Run Prettier check - `run-markdown` (boolean, default: `true`) - Run Markdown lint - `run-commits` (boolean, default: `true`) - Run commit check +- `package_json_path` (string, default: `"package.json"`) - Path to package.json + file (passed to prettier and commit-check workflows) ### Prettier Check (`prettier.yml`) - Validates that a Prettier configuration exists - Checks code formatting using Prettier - Supports all Prettier-supported file types +- Reads pnpm version from `package.json` `packageManager` field (falls back to + pnpm 10) ### Markdown Lint (`markdown-check.yml`) @@ -150,8 +176,15 @@ The combined workflow includes: - Validates PR titles follow conventional commit format - Validates all commit messages in the PR - Creates default commitlint config if missing (requires `package.json`) +- Reads pnpm version from `package.json` `packageManager` field (falls back to + pnpm 10) ## Requirements - Node.js 22+ - pnpm (installed automatically in workflows) + - The workflows read the pnpm version from your `package.json` + `packageManager` field (e.g., `"packageManager": "pnpm@9.0.0"`) + - If not specified, defaults to pnpm 10 + - You can specify a custom `package.json` path via the `package_json_path` + input if needed From 25831c4aa90b770adb8f6b3b67d26d6e4957aca8 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:23:02 +0700 Subject: [PATCH 17/36] refactor: rename package_json_path to package_json_file --- .github/workflows/commit-check.yml | 6 +++--- .github/workflows/pr-checks.yml | 6 +++--- .github/workflows/prettier.yml | 6 +++--- README.md | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 71b9c03..6734f72 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -3,7 +3,7 @@ name: Conventional Commit Check on: workflow_call: inputs: - package_json_path: + package_json_file: description: "Path to package.json file" required: false type: string @@ -25,7 +25,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_path: ${{ inputs.package_json_path }} + package_json_file: ${{ inputs.package_json_file }} - name: Install commitlint run: | @@ -34,7 +34,7 @@ jobs: - name: Create commitlint config if missing run: | - if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ inputs.package_json_path }}" 2>/dev/null; then + if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ inputs.package_json_file }}" 2>/dev/null; then echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json fi diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 7e04ce0..3d2cae9 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -20,7 +20,7 @@ on: required: false type: boolean default: true - package_json_path: + package_json_file: description: "Path to package.json file" required: false type: string @@ -47,7 +47,7 @@ jobs: false || github.event_name != 'workflow_call') uses: ./.github/workflows/prettier.yml with: - package_json_path: ${{ inputs.package_json_path }} + package_json_file: ${{ inputs.package_json_file }} markdown: needs: check-draft @@ -63,4 +63,4 @@ jobs: false || github.event_name != 'workflow_call') uses: ./.github/workflows/commit-check.yml with: - package_json_path: ${{ inputs.package_json_path }} + package_json_file: ${{ inputs.package_json_file }} diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 78236a6..0119cc2 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -3,7 +3,7 @@ name: Prettier Check on: workflow_call: inputs: - package_json_path: + package_json_file: description: "Path to package.json file" required: false type: string @@ -27,7 +27,7 @@ jobs: fi done - if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ inputs.package_json_path }}" 2>/dev/null; then + if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ inputs.package_json_file }}" 2>/dev/null; then echo "::error file=.prettierrc::No Prettier configuration file found." echo "Please create a .prettierrc file or add prettier config to package.json" exit 1 @@ -41,7 +41,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_path: ${{ inputs.package_json_path }} + package_json_file: ${{ inputs.package_json_file }} - name: Install Prettier run: pnpm add -g prettier diff --git a/README.md b/README.md index 698435d..4e0dbc3 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ jobs: checks: uses: holdex/github-actions/.github/workflows/pr-checks.yml@main with: - package_json_path: "frontend/package.json" + package_json_file: "frontend/package.json" ``` ### Option 2: Individual Workflows @@ -89,7 +89,7 @@ jobs: **Inputs:** -- `package_json_path` (string, default: `"package.json"`) - Path to package.json +- `package_json_file` (string, default: `"package.json"`) - Path to package.json file **Requirements:** @@ -127,7 +127,7 @@ jobs: **Inputs:** -- `package_json_path` (string, default: `"package.json"`) - Path to package.json +- `package_json_file` (string, default: `"package.json"`) - Path to package.json file **Requirements:** @@ -154,7 +154,7 @@ The combined workflow includes: - `run-prettier` (boolean, default: `true`) - Run Prettier check - `run-markdown` (boolean, default: `true`) - Run Markdown lint - `run-commits` (boolean, default: `true`) - Run commit check -- `package_json_path` (string, default: `"package.json"`) - Path to package.json +- `package_json_file` (string, default: `"package.json"`) - Path to package.json file (passed to prettier and commit-check workflows) ### Prettier Check (`prettier.yml`) @@ -186,5 +186,5 @@ The combined workflow includes: - The workflows read the pnpm version from your `package.json` `packageManager` field (e.g., `"packageManager": "pnpm@9.0.0"`) - If not specified, defaults to pnpm 10 - - You can specify a custom `package.json` path via the `package_json_path` + - You can specify a custom `package.json` path via the `package_json_file` input if needed From 17436561f44331953649566d2440510b73d0ed49 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:24:32 +0700 Subject: [PATCH 18/36] chore: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e0dbc3..7a695c2 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ The combined workflow includes: - Checks code formatting using Prettier - Supports all Prettier-supported file types - Reads pnpm version from `package.json` `packageManager` field (falls back to - pnpm 10) + latest pnpm) ### Markdown Lint (`markdown-check.yml`) From 20e0836e32da106464b23277a852a9d9dbfe3855 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:26:49 +0700 Subject: [PATCH 19/36] feat: add default value because running from workflow doesn't have the inputs --- .github/workflows/commit-check.yml | 4 ++-- .github/workflows/prettier.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 6734f72..598a513 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -25,7 +25,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_file: ${{ inputs.package_json_file }} + package_json_file: ${{ inputs.package_json_path || 'package.json' }} - name: Install commitlint run: | @@ -34,7 +34,7 @@ jobs: - name: Create commitlint config if missing run: | - if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ inputs.package_json_file }}" 2>/dev/null; then + if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ inputs.package_json_path || 'package.json' }}" 2>/dev/null; then echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json fi diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 0119cc2..c50a96d 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -27,7 +27,7 @@ jobs: fi done - if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ inputs.package_json_file }}" 2>/dev/null; then + if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ inputs.package_json_path || 'package.json' }}" 2>/dev/null; then echo "::error file=.prettierrc::No Prettier configuration file found." echo "Please create a .prettierrc file or add prettier config to package.json" exit 1 @@ -41,7 +41,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_file: ${{ inputs.package_json_file }} + package_json_file: ${{ inputs.package_json_path || 'package.json' }} - name: Install Prettier run: pnpm add -g prettier From 5e252d14ef79b679349a13392dbcad9d11df2851 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:28:57 +0700 Subject: [PATCH 20/36] refactor: extract the package json default to another step --- .github/workflows/commit-check.yml | 11 +++++++++-- .github/workflows/prettier.yml | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 598a513..606bfb2 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -17,6 +17,12 @@ jobs: with: fetch-depth: 0 + - name: Set package.json path + id: pkg-json + run: + echo "path=${{ inputs.package_json_file || 'package.json' }}" >> + $GITHUB_OUTPUT + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -25,7 +31,8 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_file: ${{ inputs.package_json_path || 'package.json' }} + package_json_file: ${{ steps.pkg-json.outputs.path }} + version: 10 - name: Install commitlint run: | @@ -34,7 +41,7 @@ jobs: - name: Create commitlint config if missing run: | - if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ inputs.package_json_path || 'package.json' }}" 2>/dev/null; then + if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ steps.pkg-json.outputs.path }}" 2>/dev/null; then echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json fi diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index c50a96d..df52d80 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -15,6 +15,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set package.json path + id: pkg-json + run: + echo "path=${{ inputs.package_json_file || 'package.json' }}" >> + $GITHUB_OUTPUT + - name: Check for Prettier config run: | CONFIG_FILES=".prettierrc .prettierrc.json .prettierrc.js .prettierrc.yaml .prettierrc.yml .prettierrc.toml prettier.config.js prettier.config.mjs" @@ -27,7 +33,7 @@ jobs: fi done - if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ inputs.package_json_path || 'package.json' }}" 2>/dev/null; then + if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ steps.pkg-json.outputs.path }}" 2>/dev/null; then echo "::error file=.prettierrc::No Prettier configuration file found." echo "Please create a .prettierrc file or add prettier config to package.json" exit 1 @@ -41,7 +47,8 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_file: ${{ inputs.package_json_path || 'package.json' }} + package_json_file: ${{ steps.pkg-json.outputs.path }} + version: 10 - name: Install Prettier run: pnpm add -g prettier From 44a97bc1c218ffccb5724db8cbb1c23bf6b74517 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:33:50 +0700 Subject: [PATCH 21/36] refactor: use default value in pr checks --- .github/workflows/commit-check.yml | 11 ++--------- .github/workflows/pr-checks.yml | 4 ++-- .github/workflows/prettier.yml | 11 ++--------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 606bfb2..6734f72 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -17,12 +17,6 @@ jobs: with: fetch-depth: 0 - - name: Set package.json path - id: pkg-json - run: - echo "path=${{ inputs.package_json_file || 'package.json' }}" >> - $GITHUB_OUTPUT - - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -31,8 +25,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_file: ${{ steps.pkg-json.outputs.path }} - version: 10 + package_json_file: ${{ inputs.package_json_file }} - name: Install commitlint run: | @@ -41,7 +34,7 @@ jobs: - name: Create commitlint config if missing run: | - if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ steps.pkg-json.outputs.path }}" 2>/dev/null; then + if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ inputs.package_json_file }}" 2>/dev/null; then echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json fi diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 3d2cae9..86dc039 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -47,7 +47,7 @@ jobs: false || github.event_name != 'workflow_call') uses: ./.github/workflows/prettier.yml with: - package_json_file: ${{ inputs.package_json_file }} + package_json_file: ${{ inputs.package_json_file || 'package.json' }} markdown: needs: check-draft @@ -63,4 +63,4 @@ jobs: false || github.event_name != 'workflow_call') uses: ./.github/workflows/commit-check.yml with: - package_json_file: ${{ inputs.package_json_file }} + package_json_file: ${{ inputs.package_json_file || 'package.json' }} diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index df52d80..0119cc2 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -15,12 +15,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set package.json path - id: pkg-json - run: - echo "path=${{ inputs.package_json_file || 'package.json' }}" >> - $GITHUB_OUTPUT - - name: Check for Prettier config run: | CONFIG_FILES=".prettierrc .prettierrc.json .prettierrc.js .prettierrc.yaml .prettierrc.yml .prettierrc.toml prettier.config.js prettier.config.mjs" @@ -33,7 +27,7 @@ jobs: fi done - if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ steps.pkg-json.outputs.path }}" 2>/dev/null; then + if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ inputs.package_json_file }}" 2>/dev/null; then echo "::error file=.prettierrc::No Prettier configuration file found." echo "Please create a .prettierrc file or add prettier config to package.json" exit 1 @@ -47,8 +41,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - package_json_file: ${{ steps.pkg-json.outputs.path }} - version: 10 + package_json_file: ${{ inputs.package_json_file }} - name: Install Prettier run: pnpm add -g prettier From 62ac4721cc9f02eff2a121fbd7b904cdaee440ef Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:38:28 +0700 Subject: [PATCH 22/36] docs: add custom package json file input --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7a695c2..6d2cc1e 100644 --- a/README.md +++ b/README.md @@ -177,14 +177,14 @@ The combined workflow includes: - Validates all commit messages in the PR - Creates default commitlint config if missing (requires `package.json`) - Reads pnpm version from `package.json` `packageManager` field (falls back to - pnpm 10) + latest pnpm) ## Requirements - Node.js 22+ - pnpm (installed automatically in workflows) - The workflows read the pnpm version from your `package.json` - `packageManager` field (e.g., `"packageManager": "pnpm@9.0.0"`) - - If not specified, defaults to pnpm 10 + `packageManager` field (e.g., `"packageManager": "pnpm@10.7.0"`) + - If not specified, defaults to latest pnpm - You can specify a custom `package.json` path via the `package_json_file` input if needed From a8baa550eb8607d585a085c3f5228d653dbe4c65 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:52:01 +0700 Subject: [PATCH 23/36] chore: use bun instead of pnpm --- bun.lock | 15 +++++++++++++++ package.json | 1 - pnpm-lock.yaml | 24 ------------------------ 3 files changed, 15 insertions(+), 25 deletions(-) create mode 100644 bun.lock delete mode 100644 pnpm-lock.yaml diff --git a/bun.lock b/bun.lock new file mode 100644 index 0000000..77405a7 --- /dev/null +++ b/bun.lock @@ -0,0 +1,15 @@ +{ + "lockfileVersion": 1, + "configVersion": 1, + "workspaces": { + "": { + "name": "github-actions", + "devDependencies": { + "prettier": "^3.7.4", + }, + }, + }, + "packages": { + "prettier": ["prettier@3.7.4", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA=="], + } +} diff --git a/package.json b/package.json index 3bec792..a34bd1e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "keywords": [], "author": "", "license": "ISC", - "packageManager": "pnpm@10.7.0", "devDependencies": { "prettier": "^3.7.4" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml deleted file mode 100644 index 2a14c5e..0000000 --- a/pnpm-lock.yaml +++ /dev/null @@ -1,24 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -importers: - - .: - devDependencies: - prettier: - specifier: ^3.7.4 - version: 3.7.4 - -packages: - - prettier@3.7.4: - resolution: {integrity: sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==} - engines: {node: '>=14'} - hasBin: true - -snapshots: - - prettier@3.7.4: {} From 4009909e6e204286f47d3214aee79161e1a6603b Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:54:38 +0700 Subject: [PATCH 24/36] feat: use bun instead of pnpm --- .github/workflows/commit-check.yml | 17 ++++++----------- .github/workflows/pr-checks.yml | 9 --------- .github/workflows/prettier.yml | 19 ++++--------------- 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 6734f72..39d9b72 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -17,24 +17,19 @@ jobs: with: fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Setup Bun + uses: oven-sh/setup-bun@v2 with: - node-version: "22" - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - package_json_file: ${{ inputs.package_json_file }} + bun-version: latest - name: Install commitlint run: | - pnpm add -g @commitlint/cli - pnpm add -D @commitlint/config-conventional + bun i -g @commitlint/cli + bun i -D @commitlint/config-conventional - name: Create commitlint config if missing run: | - if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "${{ inputs.package_json_file }}" 2>/dev/null; then + if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "package.json" 2>/dev/null; then echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json fi diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 86dc039..3b92e3e 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -20,11 +20,6 @@ on: required: false type: boolean default: true - package_json_file: - description: "Path to package.json file" - required: false - type: string - default: "package.json" jobs: check-draft: @@ -46,8 +41,6 @@ jobs: needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != false || github.event_name != 'workflow_call') uses: ./.github/workflows/prettier.yml - with: - package_json_file: ${{ inputs.package_json_file || 'package.json' }} markdown: needs: check-draft @@ -62,5 +55,3 @@ jobs: needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits != false || github.event_name != 'workflow_call') uses: ./.github/workflows/commit-check.yml - with: - package_json_file: ${{ inputs.package_json_file || 'package.json' }} diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 0119cc2..4878cf6 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -2,12 +2,6 @@ name: Prettier Check on: workflow_call: - inputs: - package_json_file: - description: "Path to package.json file" - required: false - type: string - default: "package.json" jobs: prettier: @@ -33,18 +27,13 @@ jobs: exit 1 fi - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Setup Bun + uses: oven-sh/setup-bun@v2 with: - node-version: "22" - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - package_json_file: ${{ inputs.package_json_file }} + bun-version: latest - name: Install Prettier - run: pnpm add -g prettier + run: bun i -g prettier - name: Check formatting run: prettier --check . From c7c6b37136d6973ff2b004e821078edfba4ddfb9 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:55:56 +0700 Subject: [PATCH 25/36] chore: remove unused inputs --- .github/workflows/commit-check.yml | 6 ------ README.md | 12 ++++-------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 39d9b72..d2e1668 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -2,12 +2,6 @@ name: Conventional Commit Check on: workflow_call: - inputs: - package_json_file: - description: "Path to package.json file" - required: false - type: string - default: "package.json" jobs: commit-check: diff --git a/README.md b/README.md index 6d2cc1e..2f20216 100644 --- a/README.md +++ b/README.md @@ -162,8 +162,7 @@ The combined workflow includes: - Validates that a Prettier configuration exists - Checks code formatting using Prettier - Supports all Prettier-supported file types -- Reads pnpm version from `package.json` `packageManager` field (falls back to - latest pnpm) +- Uses Bun for package management ### Markdown Lint (`markdown-check.yml`) @@ -176,15 +175,12 @@ The combined workflow includes: - Validates PR titles follow conventional commit format - Validates all commit messages in the PR - Creates default commitlint config if missing (requires `package.json`) -- Reads pnpm version from `package.json` `packageManager` field (falls back to - latest pnpm) +- Uses Bun for package management ## Requirements - Node.js 22+ -- pnpm (installed automatically in workflows) - - The workflows read the pnpm version from your `package.json` - `packageManager` field (e.g., `"packageManager": "pnpm@10.7.0"`) - - If not specified, defaults to latest pnpm +- Bun (installed automatically in workflows) + - Uses the latest version of Bun - You can specify a custom `package.json` path via the `package_json_file` input if needed From f41359fb456a3caad19130702adcfc06698da9b5 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:56:57 +0700 Subject: [PATCH 26/36] fix: wrong input usage of prettier --- .github/workflows/prettier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 4878cf6..b6b80bd 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -21,7 +21,7 @@ jobs: fi done - if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "${{ inputs.package_json_file }}" 2>/dev/null; then + if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "package.json" 2>/dev/null; then echo "::error file=.prettierrc::No Prettier configuration file found." echo "Please create a .prettierrc file or add prettier config to package.json" exit 1 From 554afed9e480d8049eea325720fb629c46f4ced8 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 00:59:15 +0700 Subject: [PATCH 27/36] chore: remove package json check --- .github/workflows/prettier.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index b6b80bd..734cef8 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -21,9 +21,9 @@ jobs: fi done - if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "package.json" 2>/dev/null; then + if [ "$HAS_CONFIG" = false ]; then echo "::error file=.prettierrc::No Prettier configuration file found." - echo "Please create a .prettierrc file or add prettier config to package.json" + echo "Please create a .prettierrc file" exit 1 fi From f8a62af99dda9baf34f92c7bd831d9f8cfcfb1b2 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 01:00:27 +0700 Subject: [PATCH 28/36] feat: add back prettier cehck in package json --- .github/workflows/prettier.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 734cef8..36e2da7 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -21,9 +21,9 @@ jobs: fi done - if [ "$HAS_CONFIG" = false ]; then + if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "package.json" 2>/dev/null; then echo "::error file=.prettierrc::No Prettier configuration file found." - echo "Please create a .prettierrc file" + echo "Please create a .prettierrc file or add prettier config to package.json." exit 1 fi From 9fff9028e9bb1753bfb6cf3e9f24eca9003bce93 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 01:02:15 +0700 Subject: [PATCH 29/36] chore: add clearer error message --- .github/workflows/prettier.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 36e2da7..fc9ca3f 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -23,7 +23,9 @@ jobs: if [ "$HAS_CONFIG" = false ] && ! grep -q '"prettier"' "package.json" 2>/dev/null; then echo "::error file=.prettierrc::No Prettier configuration file found." - echo "Please create a .prettierrc file or add prettier config to package.json." + echo "A Prettier config file is required to ensure consistent formatting across all developers." + echo "Without a shared config, each developer's local Prettier settings will differ, causing unnecessary formatting changes in commits." + echo "Please create a .prettierrc file in your repository root." exit 1 fi From 9d1d777c7416580e3e3d7c55836d377a255a22e1 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 01:19:02 +0700 Subject: [PATCH 30/36] chore: add pr checks self --- .github/workflows/pr-checks-self.yml | 9 +++++++++ .github/workflows/pr-checks.yml | 14 ++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/pr-checks-self.yml diff --git a/.github/workflows/pr-checks-self.yml b/.github/workflows/pr-checks-self.yml new file mode 100644 index 0000000..0772012 --- /dev/null +++ b/.github/workflows/pr-checks-self.yml @@ -0,0 +1,9 @@ +name: PR Checks + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +jobs: + checks: + uses: ./.github/workflows/pr-checks.yml@main diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 3b92e3e..1646fb4 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -1,8 +1,6 @@ name: PR Checks on: - pull_request: - types: [opened, reopened, synchronize, ready_for_review] workflow_call: inputs: run-prettier: @@ -38,20 +36,20 @@ jobs: prettier: needs: check-draft if: - needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier != - false || github.event_name != 'workflow_call') + needs.check-draft.outputs.should-run == 'true' && inputs.run-prettier != + false uses: ./.github/workflows/prettier.yml markdown: needs: check-draft if: - needs.check-draft.outputs.should-run == 'true' && (inputs.run-markdown != - false || github.event_name != 'workflow_call') + needs.check-draft.outputs.should-run == 'true' && inputs.run-markdown != + false uses: ./.github/workflows/markdown-check.yml commits: needs: check-draft if: - needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits != - false || github.event_name != 'workflow_call') + needs.check-draft.outputs.should-run == 'true' && inputs.run-commits != + false uses: ./.github/workflows/commit-check.yml From 44c76dc3a2c0867af85b61468ff3f29e77d64bb8 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 01:20:15 +0700 Subject: [PATCH 31/36] chore: remove version --- .github/workflows/pr-checks-self.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-checks-self.yml b/.github/workflows/pr-checks-self.yml index 0772012..af7576b 100644 --- a/.github/workflows/pr-checks-self.yml +++ b/.github/workflows/pr-checks-self.yml @@ -6,4 +6,4 @@ on: jobs: checks: - uses: ./.github/workflows/pr-checks.yml@main + uses: ./.github/workflows/pr-checks.yml From 10dc04cae5a12370ece7891dae0a78d6b443efd2 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 01:34:31 +0700 Subject: [PATCH 32/36] chore: remove commit messages check --- .github/workflows/commit-check.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index d2e1668..ee58c17 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -33,13 +33,3 @@ jobs: PR_TITLE: ${{ github.event.pull_request.title }} run: | echo "$PR_TITLE" | commitlint - - - name: Check commit messages - if: github.event_name == 'pull_request' - run: | - set -e - BASE_SHA="${{ github.event.pull_request.base.sha }}" - HEAD_SHA="${{ github.event.pull_request.head.sha }}" - while IFS= read -r commit_msg; do - echo "$commit_msg" | commitlint - done < <(git log --format=%s "$BASE_SHA..$HEAD_SHA") From 9cbd22bdfcad6810c281e61d45ce35d5f05d6c7c Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 01:39:07 +0700 Subject: [PATCH 33/36] docs: update readme --- .github/workflows/commit-check.yml | 4 +--- README.md | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index ee58c17..f548f9e 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -1,4 +1,4 @@ -name: Conventional Commit Check +name: Conventional Commit Check for PR Title on: workflow_call: @@ -8,8 +8,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Setup Bun uses: oven-sh/setup-bun@v2 diff --git a/README.md b/README.md index 2f20216..1f97860 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ This repository provides reusable workflows for: - **Prettier Check** - Validates code formatting with Prettier - **Markdown Lint** - Lints Markdown files using rumdl -- **Conventional Commit Check** - Validates commit messages follow conventional - commit format +- **Conventional Commit Check for PR Title** - Validates PR titles follow + conventional commit format - **PR Checks** - Combined workflow that runs all checks (or selected ones) with draft PR handling @@ -173,7 +173,6 @@ The combined workflow includes: ### Conventional Commit Check (`commit-check.yml`) - Validates PR titles follow conventional commit format -- Validates all commit messages in the PR - Creates default commitlint config if missing (requires `package.json`) - Uses Bun for package management From 3c9ae2e40e236c25efb8d03126463d4f5d36de5d Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 01:46:49 +0700 Subject: [PATCH 34/36] docs: remove package_json_file --- README.md | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/README.md b/README.md index 1f97860..e1cf5c9 100644 --- a/README.md +++ b/README.md @@ -57,18 +57,6 @@ jobs: run-commits: true ``` -#### Custom package.json Path - -If your `package.json` is not in the repository root, specify the path: - -```yaml -jobs: - checks: - uses: holdex/github-actions/.github/workflows/pr-checks.yml@main - with: - package_json_file: "frontend/package.json" -``` - ### Option 2: Individual Workflows Use individual workflows for granular control over when each check runs. @@ -87,11 +75,6 @@ jobs: uses: holdex/github-actions/.github/workflows/prettier.yml@main ``` -**Inputs:** - -- `package_json_file` (string, default: `"package.json"`) - Path to package.json - file - **Requirements:** - Prettier configuration file (`.prettierrc`, `.prettierrc.json`, etc.) or @@ -125,11 +108,6 @@ jobs: uses: holdex/github-actions/.github/workflows/commit-check.yml@main ``` -**Inputs:** - -- `package_json_file` (string, default: `"package.json"`) - Path to package.json - file - **Requirements:** - Commitlint configuration file (`.commitlintrc.json`, etc.) or `commitlint` @@ -154,8 +132,6 @@ The combined workflow includes: - `run-prettier` (boolean, default: `true`) - Run Prettier check - `run-markdown` (boolean, default: `true`) - Run Markdown lint - `run-commits` (boolean, default: `true`) - Run commit check -- `package_json_file` (string, default: `"package.json"`) - Path to package.json - file (passed to prettier and commit-check workflows) ### Prettier Check (`prettier.yml`) @@ -181,5 +157,3 @@ The combined workflow includes: - Node.js 22+ - Bun (installed automatically in workflows) - Uses the latest version of Bun - - You can specify a custom `package.json` path via the `package_json_file` - input if needed From fa737d1a372a7feeb5731dc8d594271b67f4cd32 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 01:48:01 +0700 Subject: [PATCH 35/36] docs: remove unnecessary constraint --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index e1cf5c9..56c8286 100644 --- a/README.md +++ b/README.md @@ -114,8 +114,6 @@ jobs: config in `package.json` - If no config exists, the workflow will create a default `.commitlintrc.json` file -- `package.json` is required because the workflow installs - `@commitlint/config-conventional` as a dev dependency ## Workflow Details From 56a14cfe2aa27f804f3579286ad6e3c63bf82d30 Mon Sep 17 00:00:00 2001 From: Teodorus Nathaniel Date: Tue, 23 Dec 2025 17:43:59 +0700 Subject: [PATCH 36/36] chore: use yml instead of json config --- .github/workflows/commit-check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index f548f9e..a3400d0 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -22,7 +22,8 @@ jobs: - name: Create commitlint config if missing run: | if [ ! -f .commitlintrc.json ] && [ ! -f .commitlintrc.js ] && [ ! -f .commitlintrc.yml ] && [ ! -f .commitlintrc.yaml ] && ! grep -q '"commitlint"' "package.json" 2>/dev/null; then - echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json + echo "extends:" > .commitlintrc.yml + echo " - '@commitlint/config-conventional'" >> .commitlintrc.yml fi - name: Check PR title