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 -- \ 'academic/**/*.md' 'design/**/*.md' 'engineering/**/*.md' 'finance/**/*.md' 'game-development/**/*.md' 'gis/**/*.md' 'healthcare/**/*.md' 'marketing/**/*.md' 'paid-media/**/*.md' 'sales/**/*.md' 'security/**/*.md' 'product/**/*.md' \ 'project-management/**/*.md' 'research/**/*.md' 'testing/**/*.md' 'support/**/*.md' \ 'spatial-computing/**/*.md' 'specialized/**/*.md') { echo "files<> "$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