Files
agency-agents/.github/workflows/lint-agents.yml
T

111 lines
3.9 KiB
YAML

name: Lint Agent Files
on:
pull_request:
paths:
- "academic/**"
- "design/**"
- "engineering/**"
- "finance/**"
- "game-development/**"
- "gis/**"
- "healthcare/**"
- "marketing/**"
- "paid-media/**"
- "sales/**"
- "security/**"
- "product/**"
- "project-management/**"
- "research/**"
- "testing/**"
- "support/**"
- "spatial-computing/**"
- "specialized/**"
# Changing the linter itself has to run it. Without these the whole-roster
# job below never fires, and a new rule ships untested: the color check
# went in this way and nothing in CI had ever looked at a color value.
- "scripts/lint-agents.sh"
- "scripts/convert.sh"
- "scripts/lib.sh"
jobs:
lint:
name: Validate agent frontmatter and structure
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed agent files
id: changed
run: |
FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- \
':(glob)academic/**/*.md' ':(glob)design/**/*.md' ':(glob)engineering/**/*.md' ':(glob)finance/**/*.md' ':(glob)game-development/**/*.md' ':(glob)gis/**/*.md' ':(glob)healthcare/**/*.md' ':(glob)marketing/**/*.md' ':(glob)paid-media/**/*.md' ':(glob)sales/**/*.md' ':(glob)security/**/*.md' ':(glob)product/**/*.md' \
':(glob)project-management/**/*.md' ':(glob)research/**/*.md' ':(glob)testing/**/*.md' ':(glob)support/**/*.md' \
':(glob)spatial-computing/**/*.md' ':(glob)specialized/**/*.md')
{
echo "files<<ENDOFLIST"
echo "$FILES"
echo "ENDOFLIST"
} >> "$GITHUB_OUTPUT"
if [ -z "$FILES" ]; then
echo "No agent files changed."
else
echo "Changed files:"
echo "$FILES"
fi
- name: Run agent linter
if: steps.changed.outputs.files != ''
env:
CHANGED_FILES: ${{ steps.changed.outputs.files }}
run: |
chmod +x scripts/lint-agents.sh
./scripts/lint-agents.sh $CHANGED_FILES
- name: Check agent originality
if: steps.changed.outputs.files != ''
env:
CHANGED_FILES: ${{ steps.changed.outputs.files }}
run: |
chmod +x scripts/check-agent-originality.sh
./scripts/check-agent-originality.sh $CHANGED_FILES
lint-all:
name: Whole roster, when the linter changes
runs-on: ubuntu-latest
# The job above lints the agents a PR touched, which is the right scope for
# an agent PR and the wrong one for a rule change: a new rule has to run
# against every agent before it lands, or it either breaks a division nobody
# edited or quietly does nothing.
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Did the linter or the color map change?
id: rules
run: |
RULES="scripts/lint-agents.sh scripts/convert.sh scripts/lib.sh"
CHANGED=$(git diff --name-only --diff-filter=ACMR \
"origin/${{ github.base_ref }}...HEAD" -- $RULES)
if [ -n "$CHANGED" ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "Linting the whole roster because these changed:"
echo "$CHANGED"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "Linter unchanged - the changed-files job is the right scope here."
fi
- name: Lint every agent in the roster
if: steps.rules.outputs.changed == 'true'
run: |
chmod +x scripts/lint-agents.sh
./scripts/lint-agents.sh
- name: Reject folded frontmatter fixtures
if: steps.rules.outputs.changed == 'true'
run: bash scripts/test-folded-frontmatter.sh