Back to News
RSS feedgithub.com

GitHub Action Checks AI-Written Code for Unexpected Changes

Summary

The open-source `assert-no-unexpected-changes` GitHub Action is designed to check whether code, including code written by AI, makes unexpected changes when run as a black box. It focuses on changes such as files being created, modified, or deleted without the user’s knowledge. The action builds a Docker image from the repository workspace and runs two containers: one executes only the setup, or arrange, phase, while the other executes both setup and the act phase being tested. It then runs `docker diff` on both containers and compares the resulting changes against an allowlist of permitted absolute paths. Changes outside that allowlist cause the GitHub Actions step to fail, with output identifying created, changed, or deleted paths. The workflow requires a Linux runner and supports optional setup commands, test or execution commands, an allowlist, a custom working directory, and a custom Docker base image. Changes under the configured working directory are excluded from checking, and a custom image must run as root to modify the copied workspace. The project is released under the MIT license.