Skip to content

Commit 2c32a81

Browse files
docs: sync KevinDeBenedetti/github-workflows@main
1 parent 89a1ab3 commit 2c32a81

30 files changed

+2971
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Action — actionlint
2+
3+
Validates GitHub Actions workflow files with [actionlint](https://github.com/rhysd/actionlint).
4+
5+
## Usage
6+
7+
```yaml
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- uses: KevinDeBenedetti/github-workflows/.github/actions/actionlint@main
12+
with:
13+
paths: .github/workflows/
14+
```
15+
16+
## Inputs
17+
18+
| Input | Type | Default | Description |
19+
|---|---|---|---|
20+
| `paths` | string | `.github/workflows/` | Space-separated list of workflow files or directories to validate |
21+
| `flags` | string | `''` | Extra flags passed to actionlint (e.g. `-ignore 'SC2086'`) |
22+
23+
## Steps
24+
25+
1. Download and install `actionlint` `1.7.11` into `$RUNNER_TEMP/actionlint`
26+
2. Collect all `.yml` / `.yaml` files from the given paths
27+
3. Run `actionlint [flags] <files>`
28+
29+
## Notes
30+
31+
- When `paths` points to a directory, all `.yml` and `.yaml` files within it are collected recursively.
32+
- Use `flags: '-ignore SC2086'` to suppress specific ShellCheck rules that actionlint embeds.
33+
- actionlint is downloaded fresh each run; no system-wide install is required.

github-workflows/actions/bats.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Action — bats
2+
3+
Installs [Bats](https://github.com/bats-core/bats-core) (Bash Automated Testing System) and
4+
runs shell unit tests.
5+
6+
## Usage
7+
8+
```yaml
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
submodules: true # required if using bats helpers (bats-support, bats-assert, etc.)
13+
14+
- uses: KevinDeBenedetti/github-workflows/.github/actions/bats@main
15+
with:
16+
tests-dir: tests/
17+
```
18+
19+
## Inputs
20+
21+
| Input | Type | Default | Description |
22+
|---|---|---|---|
23+
| `tests-dir` | string | `tests/` | Directory (or file) containing `.bats` test files |
24+
25+
## Steps
26+
27+
1. Install Bats `1.11.0` globally via npm
28+
2. Run `bats <tests-dir>`
29+
30+
## Notes
31+
32+
- Pass a specific `.bats` file path to `tests-dir` to run a single test file.
33+
- Bats helper libraries (`bats-support`, `bats-assert`, `bats-file`) are typically added as git
34+
submodules — check out with `submodules: true` in your checkout step.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Action — detect-changes
2+
3+
Detects which subdirectories under `apps/` (or a custom directory) have changed since the
4+
last commit, and outputs a JSON matrix for use in downstream matrix jobs.
5+
6+
## Usage
7+
8+
```yaml
9+
jobs:
10+
detect:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
changed-apps: ${{ steps.changes.outputs.changed-apps }}
14+
has-changes: ${{ steps.changes.outputs.has-changes }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: KevinDeBenedetti/github-workflows/.github/actions/detect-changes@main
21+
id: changes
22+
with:
23+
apps-directory: apps
24+
25+
build:
26+
needs: detect
27+
if: needs.detect.outputs.has-changes == 'true'
28+
strategy:
29+
matrix:
30+
app: ${{ fromJson(needs.detect.outputs.changed-apps) }}
31+
runs-on: ubuntu-latest
32+
steps:
33+
- run: echo "Building ${{ matrix.app }}"
34+
```
35+
36+
## Inputs
37+
38+
| Input | Type | Default | Description |
39+
|---|---|---|---|
40+
| `apps-directory` | string | `apps` | Root directory containing app subdirectories |
41+
| `base-ref` | string | `''` | Base git ref to compare against (auto-detected if empty) |
42+
43+
## Outputs
44+
45+
| Output | Description |
46+
|---|---|
47+
| `changed-apps` | JSON array of changed app names, e.g. `["api","web"]` |
48+
| `has-changes` | `"true"` or `"false"` — whether any app changed |
49+
| `changed-api` | `"true"` or `"false"` — whether `apps/api` changed |
50+
| `changed-web` | `"true"` or `"false"` — whether `apps/web` changed |
51+
| `changed-client` | `"true"` or `"false"` — whether `apps/client` changed |
52+
53+
## Base ref resolution
54+
55+
1. Uses `base-ref` input if provided
56+
2. Falls back to `github.event.pull_request.base.sha` on pull requests
57+
3. Falls back to `github.event.before` on push events
58+
4. Falls back to `HEAD~1` if the before SHA is empty or all zeros (e.g. first push to branch)
59+
60+
## Notes
61+
62+
- Requires `fetch-depth: 0` (or at least enough history to compare against the base ref) in your
63+
checkout step.
64+
- Per-app boolean outputs (`changed-api`, `changed-web`, `changed-client`) are useful for
65+
`if:` conditions when you don't need a matrix.
66+
- App names are sanitized (lowercased, non-alphanumeric characters replaced with `_`) in the
67+
output key names.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Action — kubeconform
2+
3+
Validates Kubernetes manifests with [kubeconform](https://github.com/yannh/kubeconform).
4+
Optionally validates CRDs against the [Datree CRDs-catalog](https://github.com/datreeio/CRDs-catalog)
5+
(cert-manager, Traefik, etc.).
6+
7+
## Usage
8+
9+
```yaml
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: KevinDeBenedetti/github-workflows/.github/actions/kubeconform@main
14+
with:
15+
paths: kubernetes/
16+
```
17+
18+
## Inputs
19+
20+
| Input | Type | Default | Description |
21+
|---|---|---|---|
22+
| `paths` | string | `kubernetes/` | Directory containing Kubernetes manifests |
23+
| `exclude` | string | `*-values.yaml` | Filename pattern to exclude from `find` |
24+
| `include-crds-catalog` | boolean | `true` | Validate CRDs against the Datree CRDs-catalog |
25+
26+
## Steps
27+
28+
1. Download and install `kubeconform` `0.7.0` to `/usr/local/bin`
29+
2. Run `kubeconform -strict -summary` on all `*.yaml` files under `paths` (excluding `exclude`)
30+
31+
## Notes
32+
33+
- Run in strict mode — any unknown field causes a validation failure.
34+
- `include-crds-catalog: true` (default) adds the Datree CRDs-catalog as an extra schema source,
35+
enabling validation of common CRD types beyond the built-in Kubernetes schemas.
36+
- Helm values files (`*-values.yaml`) are excluded by default since they are not valid Kubernetes
37+
manifests.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Action — setup-node
2+
3+
Installs Node.js and the correct package manager (**pnpm** or **bun**), restoring the
4+
appropriate dependency cache. Auto-detects the package manager from the lockfile.
5+
6+
## Usage
7+
8+
```yaml
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- uses: KevinDeBenedetti/github-workflows/.github/actions/setup-node@main
13+
with:
14+
node-version: '20'
15+
```
16+
17+
## Inputs
18+
19+
| Input | Type | Default | Description |
20+
|---|---|---|---|
21+
| `node-version` | string | `'20'` | Node.js version to install |
22+
| `working-directory` | string | `'.'` | Directory to look for lockfile and run install |
23+
| `package-manager` | string | `auto` | `pnpm` \| `bun` \| `auto` — auto-detects from lockfile |
24+
| `install` | boolean | `true` | Run install after setup |
25+
26+
## Outputs
27+
28+
| Output | Description |
29+
|---|---|
30+
| `package-manager` | Resolved package manager (`pnpm` or `bun`) |
31+
| `cache-hit` | Whether the package cache was restored |
32+
33+
## Steps
34+
35+
1. Resolve package manager (`bun.lockb` / `bun.lock` → bun, otherwise → pnpm)
36+
2. Setup pnpm **or** bun (with Node.js)
37+
3. Restore cache (pnpm store or `~/.bun/install/cache`)
38+
4. Install dependencies (`--frozen-lockfile`)
39+
40+
## Notes
41+
42+
- `install: 'false'` skips the install step — useful when you only need the toolchain and want to restore a build cache before installing.
43+
- The `package-manager` output can be used in subsequent steps to conditionally run `pnpm` or `bun` commands.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Action — setup-python
2+
3+
Installs Python with **uv** and restores the uv dependency cache.
4+
5+
## Usage
6+
7+
```yaml
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- uses: KevinDeBenedetti/github-workflows/.github/actions/setup-python@main
12+
with:
13+
python-version: '3.12'
14+
```
15+
16+
## Inputs
17+
18+
| Input | Type | Default | Description |
19+
|---|---|---|---|
20+
| `python-version` | string | `'3.12'` | Python version to install |
21+
| `working-directory` | string | `'.'` | Directory containing `pyproject.toml` |
22+
| `install` | boolean | `true` | Run `uv sync` after setup |
23+
24+
## Outputs
25+
26+
| Output | Description |
27+
|---|---|
28+
| `cache-hit` | Whether the uv cache was restored |
29+
30+
## Steps
31+
32+
1. Install [uv](https://github.com/astral-sh/uv) (latest)
33+
2. Setup Python `python-version`
34+
3. Restore uv cache keyed on `uv.lock`
35+
4. Run `uv sync --frozen`
36+
37+
## Notes
38+
39+
- `install: 'false'` skips the `uv sync` step — useful when you only need the Python + uv toolchain.
40+
- Cache key is scoped to `runner.os`, `python-version`, and the hash of `uv.lock`, so cache is invalidated when dependencies change.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Action — shellcheck
2+
3+
Runs [ShellCheck](https://www.shellcheck.net/) on all `.sh` files in the repository.
4+
5+
## Usage
6+
7+
```yaml
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- uses: KevinDeBenedetti/github-workflows/.github/actions/shellcheck@main
12+
with:
13+
severity: warning
14+
```
15+
16+
## Inputs
17+
18+
| Input | Type | Default | Description |
19+
|---|---|---|---|
20+
| `severity` | string | `warning` | Minimum severity level: `error` \| `warning` \| `info` \| `style` |
21+
| `exclude-paths` | string | `*/test_helper/*` | Glob passed to `find -not -path` to exclude from analysis |
22+
23+
## Notes
24+
25+
- Finds all `*.sh` files recursively under the current directory (excluding `exclude-paths`).
26+
- Reports issues in GCC format for clean integration with GitHub annotations.
27+
- Requires ShellCheck to be installed on the runner (available on all `ubuntu-*` runners).

0 commit comments

Comments
 (0)