跳到正文
DEV Community· Versyka·· 4 小時前AI 評分58

versyka/versyka-action 會在 PR 加入已退役的 OpenAI 或 Anthropic 模型時令 CI 失敗

Fail CI when a pull request adds a retired OpenAI or Anthropic model

AI 導讀

Versyka 的 `versyka/versyka-action@v1` 可在 pull request 檢查模型 ID,若 PR 加入已退役模型便令 CI 檢查失敗,並留言列出檔案、行號及替代模型。

正文

Cover image for Fail CI when a pull request adds a retired OpenAI or Anthropic model

Versyka

Versyka

Posted on Nov 1 AI-assisted

A retired AI model doesn't fail your tests, because your tests mock the LLM. It fails in production, the day after the shutdown date.

So check model IDs where you check everything else: on the pull request.

The workflow

.github/workflows/models.yml:

name: AI models
on: pull_request

jobs:
  models:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write   # for the PR comment
    steps:
      - uses: actions/checkout@v4
      - uses: versyka/versyka-action@v1

That's it. No account, no API key.

What happens on a PR

  • A retired model (say gpt-4-0613): the check fails, and a comment on the PR says which file and line, and what to use instead.
  • A model retiring within 90 days: the check passes, with a heads-up in the comment.
  • Everything current: the check passes quietly.

The comment is updated in place on each push, so the PR doesn't fill up with bot messages.

Options

      - uses: versyka/versyka-action@v1
        with:
          fail-on: soon     # none | retired (default) | soon | behind
          days: 60          # how far ahead counts as "soon" (default 90)
          comment: true     # comment on the PR (default true)
          path: services/api  # folder to check, for monorepos (default .)

fail-on: soon is useful the month before a big shutdown date: it turns the heads-up into a blocker.

Outputs

The step exposes retired, soon and behind as outputs, so you can branch on them:

      - id: models
        uses: versyka/versyka-action@v1
        with:
          fail-on: none
      - if: steps.models.outputs.soon != '0'
        run: echo "Models retiring soon: ${{ steps.models.outputs.soon }}"

Where the dates come from

The same retirement data behind versyka.com/model-retirements, with dates from OpenAI, Anthropic, Google, Mistral, Cohere, AWS Bedrock, Azure, Groq and Together AI.

The action is on the GitHub Marketplace.

來源:DEV Community · dev.to