mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
Replaces the 38 floating tag refs left across ci, compatibility, doc-style, docs, docs-actions, conventional-commits, nightly, release and welcome with the SHA plus version comment style already used by release-cut and build-images. Floating majors are pinned to their current release (upload-artifact v7.0.1, download-artifact v8.0.1, setup-python v7.0.0, amazon-ecr-login v2.0.1). Every SHA was checked against the tag it annotates.
66 lines
2.4 KiB
YAML
66 lines
2.4 KiB
YAML
name: Documentation Style
|
|
|
|
on:
|
|
pull_request:
|
|
# "edited" also fires when the PR is retargeted to a different base
|
|
# branch, which changes what counts as a newly added file.
|
|
types: [opened, edited, synchronize, reopened]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
no-em-dashes:
|
|
name: New files omit em-dashes
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check new files for em-dashes
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: |
|
|
# AGENTS.md: "No em-dashes anywhere, in any content. Use colons,
|
|
# commas, or periods."
|
|
#
|
|
# Scoped to files this PR adds, not lines changed in existing
|
|
# ones: plenty of existing content already has em-dashes, and
|
|
# flagging every PR that happens to touch one of those files
|
|
# would make this check noise rather than signal. New files
|
|
# start clean.
|
|
|
|
# Written as an escape, not the literal glyph: this workflow file
|
|
# is itself a new file the first time it's added, and the check
|
|
# below would otherwise flag itself for containing the character
|
|
# it's searching for.
|
|
EM_DASH=$'\u2014'
|
|
FAILED=0
|
|
|
|
# -z / -d '' throughout: plain --name-only C-quotes paths with
|
|
# non-ASCII or special characters (e.g. "caf\303\251.md"), which
|
|
# then fail to match the real file on disk and get silently
|
|
# skipped. NUL-delimited output/reads sidestep that.
|
|
while IFS= read -r -d '' file; do
|
|
[ -z "$file" ] && continue
|
|
|
|
MATCHES=$(grep -InH "$EM_DASH" -- "$file" || true)
|
|
[ -z "$MATCHES" ] && continue
|
|
|
|
FAILED=1
|
|
while IFS=: read -r path lineno content; do
|
|
echo "::error file=$path,line=$lineno::Em-dash found in new file (AGENTS.md: no em-dashes anywhere, in any content)"
|
|
echo " $path:$lineno: $content"
|
|
done <<< "$MATCHES"
|
|
done < <(git diff -z --diff-filter=A --name-only "$BASE_SHA" "$HEAD_SHA")
|
|
|
|
if [ "$FAILED" -eq 1 ]; then
|
|
echo ""
|
|
echo "Use colons, commas, or periods instead of em-dashes (U+2014). See AGENTS.md, Documentation Style."
|
|
fi
|
|
|
|
exit $FAILED
|