Files
actual/.github/workflows/check.yml
T
501bece3a1 [AI] migrations: enforce append-only migration files in CI (#8446)
* [AI] Enforce append-only migration files in CI

Shipped migrations are append-only: existing installs never re-run
them, so editing one silently forks the database schema across the user
base, and deleting one breaks the migration check for every existing
budget file. The CI migration check now diffs blob hashes against the
merge base to reject edits/deletions, keeps the existing
timestamp-ordering rule, emits advisory PR annotations for migrations
containing DROP/RENAME statements, and fails loudly when git commands
fail instead of passing on empty output.

First of a series that makes clients on different app versions sync
safely against the same budget file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [AI] Derive the newest upstream migration id with an explicit max

The ls-tree listing is alphabetical, so taking the last entry only
worked while every migration id has the same digit count.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [AI] Post advisory migration warnings as a PR comment

The risky-SQL warnings were only visible as job annotations, and since
the job passes there was no prompt to look at them. The migrations job
now uploads its findings as an artifact, and a new workflow_run workflow
(trusted base-repo context, so it also works for fork PRs whose tokens
are read-only) validates the artifact against a fixed allowlist and
posts/updates a PR comment — removing it again once the warnings are
resolved.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [AI] Align overview numbering with the inline check comments

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 06:08:46 +00:00

169 lines
5.6 KiB
YAML

name: Test
on:
push:
branches:
- master
pull_request:
merge_group:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
setup:
runs-on: depot-ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up environment
uses: ./.github/actions/setup
with:
download-translations: 'false'
constraints:
needs: setup
runs-on: depot-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up environment
uses: ./.github/actions/setup
with:
download-translations: 'false'
- name: Check dependency version consistency
run: yarn constraints
- name: Check tsconfig project references are in sync
run: yarn check:tsconfig-references
lint:
needs: setup
runs-on: depot-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up environment
uses: ./.github/actions/setup
with:
download-translations: 'false'
- name: Lint
run: yarn lint
knip:
needs: setup
runs-on: depot-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up environment
uses: ./.github/actions/setup
with:
download-translations: 'false'
- name: Build plugins service
run: yarn build:plugins-service
- name: Check for unused files, dependencies and exports
run: yarn knip
typecheck:
needs: setup
runs-on: depot-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up environment
uses: ./.github/actions/setup
with:
download-translations: 'false'
- name: Typecheck
run: yarn typecheck
validate-cli:
needs: setup
runs-on: depot-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up environment
uses: ./.github/actions/setup
with:
download-translations: 'false'
- name: Build Web
run: yarn build:server
- name: Check that the built CLI works
run: node packages/sync-server/build/bin/actual-server.js --version
test:
needs: setup
runs-on: depot-ubuntu-latest
permissions:
contents: read
id-token: write # Authenticate to Depot via GitHub OIDC for test reporting
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up environment
uses: ./.github/actions/setup
with:
download-translations: 'false'
- name: Test
run: yarn test
- name: Report test results to Depot
uses: depot/test-report-action@2ad5779840a9c63e884fa26f11d019768a27a941 # v1.0.1
if: ${{ !cancelled() && github.event_name == 'push' }}
with:
path: |
bin/test-results/junit*.xml
packages/*/test-results/junit*.xml
check-gh-actions:
runs-on: depot-ubuntu-latest
permissions:
security-events: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
migrations:
needs: setup
if: github.event_name == 'pull_request'
runs-on: depot-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
# Full history so the migration check can diff against the merge
# base with master; blobless to keep the large repo checkout fast
# (ls-tree and merge-base only need commits and trees)
fetch-depth: 0
filter: blob:none
- name: Set up environment
uses: ./.github/actions/setup
with:
download-translations: 'false'
- name: Check migrations
run: yarn workspace @actual-app/ci-actions tsx bin/check-migrations.ts
- name: Save PR number for the warnings comment workflow
if: always() && hashFiles('packages/ci-actions/migration-warnings.json') != ''
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: echo "$PR_NUMBER" > packages/ci-actions/migration-warnings-pr.txt
# Consumed by migration-warnings-comment.yml, which posts the advisory
# warnings as a PR comment (this job's token is read-only on fork PRs,
# so it can't comment itself).
- name: Upload warnings for the comment workflow
if: always() && hashFiles('packages/ci-actions/migration-warnings.json') != ''
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: migration-warnings
path: |
packages/ci-actions/migration-warnings.json
packages/ci-actions/migration-warnings-pr.txt