Communitygithub.com

AppFolio CI 統合

AppFolio 不動産管理 API 向け CI/CD パイプラインを設定します。2 段階のテスト戦略(モックベースの単体テストとサンドボックス統合テスト)により、高速な PR フィードバックと本番環境前の API 契約変更検出を実現します。

AppFolio CI 統合 とは?

このスキルは、AppFolio の不動産管理 API と連携するアプリケーション向けの CI/CD パイプラインを構築するためのものです。主要な特徴は 2 層テスト戦略です。PR (プルリクエスト) 段階ではモックベースの単体テストのみを実行することで、API クォータを消費せずに高速なフィードバックを提供します。本番ブランチ (main) へのマージ後にのみ、実際の AppFolio サンドボックス環境に対する統合テストが実行され、API 契約の変更を検出します。認証情報は GitHub Secrets で安全に管理され、統合テストは読み取り専用のフィクスチャと限られたリクエスト予算内で動作するよう設計されています。また、CI コスト管理のための API 呼び出し予算トラッキング、エラー処理テーブル、具体的な GitHub Actions ワークフロー設定が含まれており、チームはこのスキルをリポジトリに追加することで、堅牢でコスト効率の高い AppFolio 統合テストパイプラインを容易に導入できます。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace/tree/HEAD/plugins/saas-packs/appfolio-pack/skills/appfolio-ci-integration

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

AppFolio CI 統合 は何をしますか?

概要

AppFolio 不動産管理 API 統合を検証する CI パイプラインを、2 段階戦略で構成します。単体テストは AppFolio REST クライアントをモック化し、テナント検索、作業指示作成、物件一覧ロジックを API クォータを消費せずに検証します。統合テストはメインブランチマージ時のみ AppFolio サンドボックス環境に対して実行され、Basic 認証情報は GitHub Secrets として保存されます。これにより、PR フィードバックは高速かつ無料のまま、本番デプロイ前に実際の API 契約のずれを検出できます。

前提条件

  • Actions が有効化されたリポジトリ、ロックされた依存関係のインストール、および合成テナント、物件、作業指示フィクスチャのみを使用する単体テスト
  • 別途管理された AppFolio サンドボックス認証情報と、統合テスト担当者が読み取りを許可された事前プロビジョニング済みの非本番フィクスチャレコード
  • 定義された CI 所有権、固定のリクエスト予算、および認証情報のローテーション、プロバイダ障害、サンドボックスデータリセットのためのインシデントパス

手順

  1. プルリクエストチェックはモックのみに限定し、AppFolio 認証情報を信頼されていないコードやフォークされた PR に公開しないでください。
  2. ライブサンドボックスジョブは、リント、型チェック、単体テストが合格した後の保護された main プッシュにゲートし、認証情報はリポジトリシークレットを通じてのみ注入してください。
  3. 統合テストの実行は、既知の読み取り専用フィクスチャ、1 ワーカー、および明示されたリクエスト予算に制限し、編集されたステータスとカウント証跡のみを記録してください。
  4. 認証失敗、レート制限、またはフィクスチャの欠落は、CI から共有サンドボックスデータを作成するのではなく、リリースをブロックする条件として扱ってください。

GitHub Actions ワークフロー

# .github/workflows/appfolio-tests.yml
name: AppFolio API Tests
on: [push, pull_request]

jobs:
  unit-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20' }
      - run: npm ci
      - run: npm run lint && npm run typecheck
      - run: npm test -- --testPathPattern=unit  # API 認証情報は不要

  integration-tests:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    needs: unit-tests
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20' }
      - run: npm ci
      - run: npm test -- --testPathPattern=integration
        env:
          APPFOLIO_CLIENT_ID: ${{ secrets.APPFOLIO_CLIENT_ID }}
          APPFOLIO_CLIENT_SECRET: ${{ secrets.APPFOLIO_CLIENT_SECRET }}
          APPFOLIO_BASE_URL: ${{ secrets.APPFOLIO_SANDBOX_URL }}

モックベース単体テスト

// tests/unit/work-order-service.test.ts
import { describe, it, expect, vi } from 'vitest';
import { createWorkOrder } from '../../src/services/work-order-service';
import * as appfolioClient from '../../src/lib/appfolio-client';

vi.mock('../../src/lib/appfolio-client');

describe('WorkOrderService', () => {
  it('creates a maintenance work order for a property', async () => {
    vi.mocked(appfolioClient.post).mockResolvedValue({
      id: 'wo-4821',
      property_id: 'prop-100',
      category: 'Plumbing',
      status: 'Open',
    });

    const result = await createWorkOrder('prop-100', 'Plumbing', 'Leaking faucet unit 3B');
    expect(result.status).toBe('Open');
    expect(appfolioClient.post).toHaveBeenCalledWith('/work_orders', {
      property_id: 'prop-100',
      category: 'Plumbing',
      description: 'Leaking faucet unit 3B',
    });
  });
});

統合テスト

// tests/integration/tenant-lookup.test.ts
import { describe, it, expect } from 'vitest';
import { AppFolioClient } from '../../src/lib/appfolio-client';

const canRun = process.env.APPFOLIO_CLIENT_ID && process.env.APPFOLIO_CLIENT_SECRET;

describe.skipIf(!canRun)('AppFolio Tenant Lookup (live sandbox)', () => {
  const client = new AppFolioClient({
    clientId: process.env.APPFOLIO_CLIENT_ID!,
    clientSecret: process.env.APPFOLIO_CLIENT_SECRET!,
    baseUrl: process.env.APPFOLIO_BASE_URL!,
  });

  it('lists tenants for a known property', async () => {
    const tenants = await client.get('/tenants', { property_id: 'prop-100' });
    expect(Array.isArray(tenants)).toBe(true);
    expect(tenants[0]).toHaveProperty('lease_status');
  });
});

CI コスト管理

// tests/helpers/api-budget.ts
let callCount = 0;
const MAX_CALLS_PER_RUN = 25; // AppFolio サンドボックスは 100 req/min のレート制限

export function trackApiCall(): void {
  callCount++;
  if (callCount > MAX_CALLS_PER_RUN) {
    throw new Error(
      `CI API budget exceeded: ${callCount}/${MAX_CALLS_PER_RUN} calls. ` +
      'Reduce integration test scope or split across jobs.'
    );
  }
}

export function getCallCount(): number { return callCount; }

エラー処理

CI 問題原因修正方法
統合ジョブで 401 Unauthorizedサンドボックス認証情報の期限切れまたはローテーションGitHub Secrets で APPFOLIO_CLIENT_ID と APPFOLIO_CLIENT_SECRET を再生成
429 Too Many Requestsサンドボックスのレート制限 (100 req/min) に並列テストが抵触統合テストを --maxWorkers=1 で実行
テナントリストが空AppFolio によるサンドボックスデータの定期的なリセットジョブを停止し、CI の外部で事前プロビジョニングされたフィクスチャを復元
API レスポンスで型チェック失敗AppFolio スキーマが予告なく更新されたOpenAPI 仕様から型を再生成し、インターフェースを更新
統合ジョブがスキップされたブランチ保護ルールが refs/heads/main と一致していないワークフローの if 条件がデフォルトブランチ名と一致することを確認

出力

  • モックのみのリント、型チェック、単体テストからのプルリクエスト結果
  • 編集されたプロバイダステータス、フィクスチャ識別情報、リクエスト数、統合テスト結果を含む保護ブランチサンドボックスレシート
  • 認証情報の利用不可、プロバイダエラー、フィクスチャのずれ、またはリクエスト予算の枯渇時にブロックする、範囲指定されたリリース決定

使用例

作業指示マッピングの変更の場合、新しいフィールドを合成モックレスポンスに追加し、PR スイートで検証します。マージ後、保護されたメインワークフローは、事前プロビジョニングされた 1 つのサンドボックス作業指示を読み取り、テナント、物件、作業指示を作成せずに正規化された形状を確認します。フィクスチャが利用できない場合、認証情報が失敗した場合、またはリクエスト予算を超えた場合は、リリースをブロックとマークし、サンドボックス所有者がフィクスチャまたは認証情報を復元してからライブラインを再実行してください。

リソース

次のステップ

appfolio-deploy-integration を参照してください。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

jeremylongshore/tons-of-skills-marketplace

Use when asked to structure a landing page for positioning, plan a conversion-optimized page layout, or design a launch page. Examples: "landing page for product launch", "conversion-optimized layout for SaaS

jeremylongshore/tons-of-skills-marketplace

Use when asked to design growth-optimized landing pages, activation funnel layouts, or experiment-friendly page structures. Examples: "growth-optimized landing", "activation funnel layout", "A/B testable page

jeremylongshore/tons-of-skills-marketplace

Use when asked to structure a landing page, design page layout for conversion, or plan landing page information architecture. Examples: "landing page structure for SaaS", "conversion-optimized layout

jeremylongshore/tons-of-skills-marketplace

Generate polished demo videos from a single prompt. Use when the user asks to create a demo video, product walkthrough, feature showcase, or animated presentation. Trigger with "make a demo video", "create a product video", "demo walkthrough", or "feature showcase video".

jeremylongshore/tons-of-skills-marketplace

Track cryptocurrency portfolio with real-time valuations, allocation analysis, and P&L tracking. Use when checking portfolio value, viewing holdings breakdown, analyzing allocations, or exporting portfolio data. Trigger with phrases like "show my portfolio", "check crypto holdings", "portfolio allocation", "track my crypto", or "export portfolio".

jeremylongshore/tons-of-skills-marketplace

Runs the full release workflow for the current project. Commits any uncommitted changes, pushes to remote, creates and merges a PR if on a feature branch, determines the next semver version from conventional commits, creates an annotated git tag and GitHub release with generated notes, cleans up merged branches, and returns to a clean main. Use when the user says promote, ship, release, commit and push, tag and release, or get back to main.

jeremylongshore/tons-of-skills-marketplace

Agent skill at plugins/productivity/content-multiplier/skills/channel-formats/SKILL.md

jeremylongshore/tons-of-skills-marketplace

Operate an evidence-backed editorial queue, balance topic and format coverage, schedule approved drafts, and reconcile backlog state with the publishing system. Use when choosing or scheduling the next blog work. Trigger with "show the editorial calendar" or "pick the next topic".

jeremylongshore/tons-of-skills-marketplace

Diagnose and fix common AppFolio API integration errors. Trigger: "appfolio error".

jeremylongshore/tons-of-skills-marketplace

Build property management dashboard with AppFolio API data. Trigger: "appfolio property dashboard".

jeremylongshore/tons-of-skills-marketplace

Automate tenant management and lease operations with AppFolio. Trigger: "appfolio tenant management".

jeremylongshore/tons-of-skills-marketplace

Collect AppFolio API debug evidence for support tickets. Trigger: "appfolio debug".

jeremylongshore/tons-of-skills-marketplace

Deploy AppFolio integration service to cloud infrastructure. Trigger: "deploy appfolio".

jeremylongshore/tons-of-skills-marketplace

Query AppFolio properties, units, and tenants via REST API. Trigger: "appfolio hello world".

jeremylongshore/tons-of-skills-marketplace

Configure AppFolio Stack API authentication with OAuth 2.0. Use when setting up property management API access, registering as an AppFolio Stack partner, or configuring client credentials for API calls. Trigger: "install appfolio", "setup appfolio", "appfolio auth", "appfolio API key".

jeremylongshore/tons-of-skills-marketplace

Set up local development for AppFolio property management API integration. Trigger: "appfolio local dev".

jeremylongshore/tons-of-skills-marketplace

Production readiness checklist for AppFolio integrations. Trigger: "appfolio production checklist".

jeremylongshore/tons-of-skills-marketplace

Handle AppFolio API rate limits with throttling and backoff. Trigger: "appfolio rate limit".

jeremylongshore/tons-of-skills-marketplace

Reference architecture for AppFolio property management integration. Trigger: "appfolio architecture".

jeremylongshore/tons-of-skills-marketplace

Apply production-ready patterns for AppFolio REST API integration. Trigger: "appfolio patterns".

関連スキル