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
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
quality:
uses: ./.github/workflows/reusable-quality.yml
with:
setup-node: false
run-format-check: false
run-lint: false
run-test: false
Comment on lines +16 to +19

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enable actual checks in default CI workflow

This CI entrypoint disables every validation input (setup-node, run-format-check, run-lint, and run-test are all false), so on both pull_request and push events the required quality check can pass after only checkout with no quality signal. That creates false-green protection status and allows regressions to merge unnoticed unless every consumer manually edits the workflow first.

Useful? React with 👍 / 👎.

22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
pull-requests: write
Comment on lines +9 to +11

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add required issues permission for release-please

The workflow grants contents and pull-requests but omits issues: write, which release-please-action uses for PR labeling (autorelease:*) under its default settings. In repositories using least-privilege GITHUB_TOKEN permissions, this causes release runs to fail when trying to label/update the release PR.

Useful? React with 👍 / 👎.


jobs:
release-please:
runs-on: ubuntu-latest

steps:
- name: Release Please
uses: googleapis/release-please-action@v4
with:
release-type: simple

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use a release type compatible with repository layout

Switching release-please-action to release-type: simple will break release PR generation once a releasable commit lands, because the simple strategy expects and updates a version.txt file, but this repository does not include one (the tree in this commit has CHANGELOG.md but no version.txt). That makes the default release workflow non-functional unless the strategy or tracked version file is changed.

Useful? React with 👍 / 👎.

changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Maintenance","hidden":false}]'
84 changes: 84 additions & 0 deletions .github/workflows/reusable-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Reusable Quality Checks

on:
workflow_call:
inputs:
checkout-fetch-depth:
description: Git checkout fetch depth.
required: false
default: 0
type: number
setup-node:
description: Enable Node.js setup.
required: false
default: true
type: boolean
node-version:
description: Node.js version for JS/TS projects.
required: false
default: '20'
type: string
run-format-check:
description: Run formatting validation command.
required: false
default: true
type: boolean
format-command:
description: Command used for format validation.
required: false
default: npm run format:check --if-present
type: string
run-lint:
description: Run lint command.
required: false
default: true
type: boolean
lint-command:
description: Command used for lint validation.
required: false
default: npm run lint --if-present
type: string
run-test:
description: Run automated tests.
required: false
default: true
type: boolean
test-command:
description: Command used to run test suite.
required: false
default: npm test --if-present
type: string

jobs:
quality:
name: Quality
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: ${{ inputs.checkout-fetch-depth }}

- name: Set up Node.js
if: ${{ inputs.setup-node }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: npm

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make setup-node cache strategy configurable

The reusable workflow always sets cache: npm when setup-node is enabled, which can break repositories that do not use npm lockfiles; actions/setup-node resolves cache keys from lockfiles and fails when the expected files are absent. In this template that means CI can fail before any project commands run unless consumers edit the workflow, so cache behavior should be optional or parameterized by package manager/lockfile path.

Useful? React with 👍 / 👎.


- name: Install dependencies
if: ${{ inputs.setup-node }}
run: npm ci
Comment on lines +70 to +72

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make dependency install command configurable

The reusable workflow hard-codes npm ci whenever setup-node is enabled, so repositories that use Node but not npm (for example pnpm/yarn) will fail before their configured format-command, lint-command, or test-command can run. This breaks the template’s stated stack-agnostic configurability in real CI usage unless consumers also rewrite the workflow, so the install step should be optional or driven by an input command.

Useful? React with 👍 / 👎.


- name: Format check
if: ${{ inputs.run-format-check }}
run: ${{ inputs.format-command }}

- name: Lint
if: ${{ inputs.run-lint }}
run: ${{ inputs.lint-command }}

- name: Test
if: ${{ inputs.run-test }}
run: ${{ inputs.test-command }}
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Thanks for your interest in contributing.

1. Fork and create a branch: `feature/short-description`
2. Make your changes with clear commit messages.
3. Run tests/lint locally (if configured).
3. Run local validation (`format:check`, `lint`, `test`) before opening your PR.
4. Open a pull request using the PR template.

## Pull request checklist
Expand All @@ -22,3 +22,8 @@ Thanks for your interest in contributing.
- [ ] Docs are updated (if behavior changed)
- [ ] Changelog updated (if needed)

## Local automation defaults

- Bootstrap: `./scripts/bootstrap.sh`
- Setup guide: `docs/developer-setup.md`
- CI workflows: `.github/workflows/`
69 changes: 69 additions & 0 deletions docs/developer-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Developer Setup

This guide provides generic onboarding defaults intended for template-based repositories.

## 1) Prerequisites

- Git 2.40+
- A language runtime/toolchain for your project (Node, Python, Go, etc.)
- A package manager (`npm`, `pnpm`, `pip`, `poetry`, `go`, etc.)

## 2) Bootstrap locally

```bash
git clone <your-repo-url>
cd <your-repo>
./scripts/bootstrap.sh
```

If your repository is not Node.js based, adapt `scripts/bootstrap.sh` to your stack and keep command names consistent with CI.

## 3) Recommended task contract

To keep automation portable, define task commands with predictable names:

- `format:check` — formatting validation
- `lint` — static analysis/linting
- `test` — automated tests

This template's reusable workflow can call any shell command, but these names improve discoverability.

## 4) CI customization

The repository ships with:

- `.github/workflows/reusable-quality.yml` (reusable workflow)
- `.github/workflows/ci.yml` (default entry workflow)
- `.github/workflows/release.yml` (semantic release PR/tag automation)

In `ci.yml`, enable checks by setting:

- `setup-node: true` for JS/TS projects
- `run-format-check: true`
- `run-lint: true`
- `run-test: true`

Then optionally override commands:

```yaml
with:
setup-node: true
format-command: npm run format:check
lint-command: npm run lint
test-command: npm test
```

## 5) Branch and PR workflow

1. Create a branch from `main`.
2. Run local validation commands before opening a PR.
3. Open a focused PR and include context for reviewers.
4. Merge only when CI checks pass.

## 6) Lightweight automation standards

- Keep workflows minimal and composable.
- Prefer reusable workflows (`workflow_call`) over duplicated YAML.
- Avoid stack-specific assumptions in template defaults.
- Keep commands configurable through workflow inputs.
- Fail fast in CI and keep logs clear.
16 changes: 16 additions & 0 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail

if [[ ! -f package.json ]]; then
echo "No package.json found. This bootstrap script is currently oriented to Node.js projects."
echo "Copy and adapt scripts/bootstrap.sh for your stack (Python, Go, Rust, etc.)."
exit 0
fi

if command -v npm >/dev/null 2>&1; then
npm ci

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fall back when lockfile is missing in bootstrap

The bootstrap script unconditionally runs npm ci whenever package.json exists, but npm ci requires an existing package-lock.json/npm-shrinkwrap.json; without one it exits with an error. That makes the documented first-run bootstrap path fail for Node repos that have not committed a lockfile yet, so the script should either check for a lockfile first or fall back to npm install.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex rebase this branch onto the latest main and resolve all merge conflicts.

Requirements:

  • fetch latest origin/main
  • preserve functionality from both branches where possible
  • keep newer architecture changes
  • preserve security and dependency updates
  • remove all conflict markers
  • run lint/tests if available
  • push with --force-with-lease

Workflow:

git fetch origin
git checkout
git rebase origin/main

resolve conflicts

git add .
git rebase --continue
git push --force-with-lease

After completion, summarize:

  • conflicted files
  • resolution decisions
  • any behavioral changes introduced

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • I could not perform the requested rebase because this repository snapshot still has no origin remote and no main branch to fetch/rebase onto.
  • Current state is unchanged:
    • only local branch: work
    • no remotes configured
    • PR base SHA 470cd3ba7082b7d2e838701563cc8211efa5a98b is not present locally
  • Because rebasing was blocked, there were no conflict resolutions, no new commit, and no follow-up PR creation via make_pr.

Requested post-rebase report

  • Conflicted files: none (rebase did not start).
  • Resolution decisions: none (no merge/rebase context available).
  • Behavioral changes introduced: none (working tree unchanged).

Testing

  • pwd; rg --files -g 'AGENTS.md' (confirmed repo path; no AGENTS.md found in scope)
  • git status --short; git branch -vv; git remote -v; git rev-parse --abbrev-ref HEAD
  • git branch --list; git show-ref --heads --tags | head -n 20; git cat-file -t 470cd3ba7082b7d2e838701563cc8211efa5a98b 2>/dev/null || echo missing-base-sha

If you provide a repo state with origin/main available, I can immediately run the exact workflow (fetchrebase → resolve conflicts → validate → force-with-lease push) and then report the conflict/file-level decisions.

View task →

echo "Dependencies installed."
else
echo "npm is not installed. Please install Node.js 20+ and retry."
exit 1
fi
Loading