mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-06-05 11:08:41 +02:00
docs: add contributor guidelines
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# Repository Guidelines
|
||||
|
||||
## Project Structure & Module Organization
|
||||
|
||||
This repository contains a TypeScript GitHub Action for installing Hugo. Runtime source lives in `src/`, with `src/index.ts` as the action entry and `src/main.ts` coordinating input handling and installation. Tests live in `__tests__/`, with fixtures in `__tests__/data/`. The action metadata is `action.yml`; it points to the bundled output `lib/index.js`, which is generated by `npm run build`. Workflow automation is under `.github/workflows/`, and project imagery is in `images/`.
|
||||
|
||||
## Build, Test, and Development Commands
|
||||
|
||||
- `npm ci`: install dependencies from `package-lock.json`.
|
||||
- `npm run all`: run format check, ESLint, and Jest tests; use this before opening a PR.
|
||||
- `npm test`: run Jest with coverage and verbose output.
|
||||
- `npm run lint` / `npm run lint:fix`: check or fix TypeScript lint issues.
|
||||
- `npm run format:check` / `npm run format`: check or apply Prettier formatting for `*.ts`.
|
||||
- `npm run build`: bundle `src/index.ts` into `lib/` with `ncc`.
|
||||
- `make build`, `make test`, `make all`: run the Docker-based development image and test flow.
|
||||
|
||||
## Coding Style & Naming Conventions
|
||||
|
||||
Use TypeScript with `strict` and `noImplicitAny` enabled. Follow the existing Prettier settings: 2-space indentation, single quotes, semicolons, 100-column print width, no trailing commas, and no bracket spacing. Use named exports for reusable helpers, keep filenames lowercase with hyphenated words such as `get-latest-version.ts`, and keep tests named `*.test.ts`. Makefiles use tabs, as defined in `.editorconfig`.
|
||||
|
||||
## Testing Guidelines
|
||||
|
||||
Jest with `ts-jest` and `jest-circus` runs all `**/*.test.ts` files in a Node environment. Add focused unit tests next to related behavior in `__tests__/`, and place mocked API responses or reusable input data in `__tests__/data/`. Preserve or improve coverage when changing installer logic, URL generation, OS/arch detection, or latest-version lookup.
|
||||
|
||||
## Commit & Pull Request Guidelines
|
||||
|
||||
Commit history follows short Conventional Commit-style prefixes such as `feat:`, `ci:`, and `docs:`. Keep commit subjects imperative and scoped to one change. PRs should describe the behavior change, mention linked issues when applicable, and list verification commands such as `npm run all` and `npm run build`. Include updates to `README.md`, `action.yml`, and tests whenever inputs, runtime behavior, or documented examples change.
|
||||
|
||||
## Agent-Specific Instructions
|
||||
|
||||
Use English for repository-facing content, including documentation, code comments, commit messages, and pull request text, unless the task explicitly requires another language.
|
||||
Reference in New Issue
Block a user