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

on:
workflow_call:
inputs:
files:
type: string
default: "**/*.html"
prettier_version:
type: string
default: "latest"

jobs:
format:
name: format
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
persist-credentials: false

- name: Check HTML file formatting
env:
INPUTS_PRETTIER_VERSION: ${{ inputs.prettier_version }}
INPUTS_FILES: ${{ inputs.files }}
run: |
set -euo pipefail

# Split INPUTS_FILES into an array (space-separated)
IFS=' ' read -r -a files <<<"$INPUTS_FILES"

npx --yes "prettier@${INPUTS_PRETTIER_VERSION}" \
--check \
--debug-check \
--color \
-- "${files[@]}"
38 changes: 38 additions & 0 deletions .github/workflows/check-stylelint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: check stylelint

on:
workflow_call:
inputs:
files:
type: string
default: "**/*.css"
stylelint_version:
type: string
default: "latest"

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
persist-credentials: false

- name: Lint CSS files
env:
INPUTS_FILES: ${{ inputs.files }}
INPUTS_STYLELINT_VERSION: ${{ inputs.stylelint_version }}
run: |
set -euo pipefail

if [[ -z "${INPUTS_FILES}" ]]; then
echo "No CSS files to lint."
exit 0
fi

# Split INPUTS_FILES into an array (space-separated)
IFS=' ' read -r -a files <<<"$INPUTS_FILES"

npx --yes "stylelint@${INPUTS_STYLELINT_VERSION}" -- "${files[@]}"
22 changes: 22 additions & 0 deletions .github/workflows/detect-changed-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
value: ${{ jobs.filter_changes.outputs.added_or_modified }}
added_or_modified_files:
value: ${{ jobs.filter_changes.outputs.added_or_modified_files }}
css:
value: ${{ jobs.filter_changes.outputs.css }}
css_files:
value: ${{ jobs.filter_changes.outputs.css_files }}
flutter:
value: ${{ jobs.filter_changes.outputs.flutter }}
flutter_files:
Expand All @@ -15,6 +19,10 @@ on:
value: ${{ jobs.filter_changes.outputs.github_actions }}
github_actions_files:
value: ${{ jobs.filter_changes.outputs.github_actions_files }}
html:
value: ${{ jobs.filter_changes.outputs.html }}
html_files:
value: ${{ jobs.filter_changes.outputs.html_files }}
markdown:
value: ${{ jobs.filter_changes.outputs.markdown }}
markdown_files:
Expand All @@ -37,10 +45,14 @@ jobs:
outputs:
added_or_modified: ${{ steps.filter.outputs.added_or_modified }}
added_or_modified_files: ${{ steps.filter.outputs.added_or_modified_files }}
css: ${{ steps.filter.outputs.css }}
css_files: ${{ steps.filter.outputs.css_files }}
flutter: ${{ steps.filter.outputs.flutter }}
flutter_files: ${{ steps.filter.outputs.flutter_files }}
github_actions: ${{ steps.filter.outputs.github_actions }}
github_actions_files: ${{ steps.filter.outputs.github_actions_files }}
html: ${{ steps.filter.outputs.html }}
html_files: ${{ steps.filter.outputs.html_files }}
markdown: ${{ steps.filter.outputs.markdown }}
markdown_files: ${{ steps.filter.outputs.markdown_files }}
rust: ${{ steps.filter.outputs.rust }}
Expand All @@ -62,13 +74,17 @@ jobs:
filters: |
added_or_modified:
- added|modified: '**'
css:
- added|modified: '**/*.css'
flutter:
- '**/*.dart'
- '**/pubspec.*'
- 'analysis_options.yaml'
github_actions:
- added|modified: .github/workflows/*.yml
- added|modified: .github/workflows/*.yaml
html:
- added|modified: '**/*.html'
markdown:
- added|modified: '**/*.md'
rust:
Expand All @@ -82,10 +98,14 @@ jobs:
env:
ADDED_OR_MODIFIED: ${{ steps.filter.outputs.added_or_modified }}
ADDED_OR_MODIFIED_FILES: ${{ steps.filter.outputs.added_or_modified_files }}
CSS: ${{ steps.filter.outputs.css }}
CSS_FILES: ${{ steps.filter.outputs.css_files }}
FLUTTER: ${{ steps.filter.outputs.flutter }}
FLUTTER_FILES: ${{ steps.filter.outputs.flutter_files }}
GH_ACTIONS: ${{ steps.filter.outputs.github_actions }}
GH_ACTIONS_FILES: ${{ steps.filter.outputs.github_actions_files }}
HTML: ${{ steps.filter.outputs.html }}
HTML_FILES: ${{ steps.filter.outputs.html_files }}
MARKDOWN: ${{ steps.filter.outputs.markdown }}
MARKDOWN_FILES: ${{ steps.filter.outputs.markdown_files }}
RUST: ${{ steps.filter.outputs.rust }}
Expand Down Expand Up @@ -124,8 +144,10 @@ jobs:

echo "### :mag: Changed file categories" >>"$GITHUB_STEP_SUMMARY"
emit_category "Any tracked files" "${ADDED_OR_MODIFIED}" "${ADDED_OR_MODIFIED_FILES}"
emit_category "CSS" "${CSS}" "${CSS_FILES}"
emit_category "Flutter" "${FLUTTER}" "${FLUTTER_FILES}"
emit_category "GitHub Actions" "${GH_ACTIONS}" "${GH_ACTIONS_FILES}"
emit_category "HTML" "${HTML}" "${HTML_FILES}"
emit_category "Markdown" "${MARKDOWN}" "${MARKDOWN_FILES}"
emit_category "Rust" "${RUST}" "${RUST_FILES}"
emit_category "Zig" "${ZIG}" "${ZIG_FILES}"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ General-purpose workflows intended for use by any repository:

- `detect-changed-files.yml` – Expose paths-filter outputs for conditional jobs
- `check-github-actions.yml` – Lint workflows via actionlint
- `check-html.yml` – Format and lint HTML via Prettier
- `check-markdown.yml` – Format and lint Markdown via Prettier
- `check-shell.yml` – Format and lint shell scripts
- `check-spelling.yml` – Spellcheck via typos
- `check-stylelint.yml` – Lint CSS via stylelint
- `label-pull-request.yml` – Apply labels via actions/labeler
- `ready-to-merge.yml` – Ensure all required jobs truly passed
- `preload-caches-actionlint.yml` – Cache the actionlint binary
Expand Down
97 changes: 91 additions & 6 deletions docs/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ For each filter name listed below:
| Filter | Meaning |
| ------------------- | ------------------------------------------- |
| `added_or_modified` | Any file added or modified |
| `css` | CSS changes |
| `flutter` | Dart / pubspec / analysis options changes |
| `github_actions` | Workflow changes under `.github/workflows/` |
| `html` | HTML changes |
| `markdown` | Markdown changes |
| `rust` | Rust / Cargo changes |
| `zig` | Zig / zon changes |
Expand Down Expand Up @@ -67,12 +69,57 @@ jobs:
Lints GitHub Actions workflow files using
[actionlint](https://github.com/rhysd/actionlint).

**Inputs**

| Name | Required | Default |
| ---------------- | -------- | --------- |
| `zizmor_persona` | false | `regular` |

`zizmor_persona` must be `regular`, `pedantic`, or `auditor`.

---

## check-html.yml

Checks HTML formatting using [Prettier](https://prettier.io/).

**Inputs**

| Name | Required | Default |
| ------------------ | -------- | ----------- |
| `files` | false | `**/*.html` |
| `prettier_version` | false | `latest` |

**Typical usage with changed files**

```yml
jobs:
detect_changed_files:
permissions:
pull-requests: read
uses: EarthmanMuons/reusable-workflows/.github/workflows/detect-changed-files.yml@main

check_html:
needs: detect_changed_files
if: needs.detect_changed_files.outputs.html == 'true'
uses: EarthmanMuons/reusable-workflows/.github/workflows/check-html.yml@main
with:
files: ${{ needs.detect_changed_files.outputs.html_files }}
```

---

## check-markdown.yml

Checks Markdown formatting using [Prettier](https://prettier.io/).

**Inputs**

| Name | Required | Default |
| ------------------ | -------- | --------- |
| `files` | false | `**/*.md` |
| `prettier_version` | false | `latest` |

---

## check-shell.yml
Expand All @@ -87,6 +134,44 @@ Formats and lints shell scripts using
Detects common misspellings across files using
[typos](https://github.com/crate-ci/typos).

**Inputs**

| Name | Required | Default |
| ------- | -------- | ------- |
| `files` | false | `.` |

---

## check-stylelint.yml

Lints CSS files using [stylelint](https://stylelint.io/). By default, it runs
the latest published stylelint package through `npx`; callers can pin
`stylelint_version` when they need a fixed version.

**Inputs**

| Name | Required | Default |
| ------------------- | -------- | ---------- |
| `files` | false | `**/*.css` |
| `stylelint_version` | false | `latest` |

**Typical usage with changed files**

```yml
jobs:
detect_changed_files:
permissions:
pull-requests: read
uses: EarthmanMuons/reusable-workflows/.github/workflows/detect-changed-files.yml@main

check_stylelint:
needs: detect_changed_files
if: needs.detect_changed_files.outputs.css == 'true'
uses: EarthmanMuons/reusable-workflows/.github/workflows/check-stylelint.yml@main
with:
files: ${{ needs.detect_changed_files.outputs.css_files }}
```

---

## label-pull-request.yml
Expand Down Expand Up @@ -124,9 +209,9 @@ branch protection rules.

**Inputs**

| Name | Required |
| --------------- | -------- |
| `needs_context` | true |
| Name | Required | Default |
| --------------- | -------- | ------- |
| `needs_context` | true | — |

`needs_context` should be set to `${{ toJson(needs) }}`.

Expand Down Expand Up @@ -177,9 +262,9 @@ Create and push a missing SemVer tag (via

**Inputs**

| Name | Required |
| ------------------- | -------- |
| `toolbox_envy_bins` | true |
| Name | Required | Default |
| ------------------- | -------- | ------- |
| `toolbox_envy_bins` | true | — |

The `toolbox_envy_bins` entries must exist as `bin/<name>` in Toolbox Envy and
may be newline- or comma-separated; invalid names will fail the job.
Expand Down
Loading
Loading