mirror of
https://github.com/astral-sh/ty.git
synced 2025-07-07 11:35:00 +00:00
[CI] Add check for changes in autogenerated files (#415)
This commit is contained in:
parent
44f26717cf
commit
b6767534cf
4 changed files with 53 additions and 7 deletions
4
.gitattributes
vendored
4
.gitattributes
vendored
|
@ -1 +1,5 @@
|
|||
* text=auto eol=lf
|
||||
|
||||
docs/reference/cli.md linguist-generated=true
|
||||
docs/reference/configuration.md linguist-generated=true
|
||||
docs/reference/rules.md linguist-generated=true
|
||||
|
|
25
.github/workflows/ci.yaml
vendored
25
.github/workflows/ci.yaml
vendored
|
@ -71,3 +71,28 @@ jobs:
|
|||
exit_code="${PIPESTATUS[0]}"
|
||||
echo '```' >> "$GITHUB_STEP_SUMMARY"
|
||||
exit "$exit_code"
|
||||
|
||||
generated-check:
|
||||
name: "Check generated files unedited"
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
submodules: recursive
|
||||
|
||||
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
|
||||
|
||||
- name: "Run auto generation scripts"
|
||||
run: |
|
||||
./scripts/autogenerate_files.sh
|
||||
|
||||
- name: "Check for uncommitted changes"
|
||||
run: |
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
echo "Error: Auto-generated files were manually edited."
|
||||
echo "Files with changes:"
|
||||
git status --porcelain
|
||||
exit 1
|
||||
fi
|
||||
|
|
23
scripts/autogenerate_files.sh
Executable file
23
scripts/autogenerate_files.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
# Generate files and copy documentation from Ruff.
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
# ./scripts/autogenerate-files.sh
|
||||
#
|
||||
set -eu
|
||||
|
||||
script_root="$(realpath "$(dirname "$0")")"
|
||||
project_root="$(dirname "$script_root")"
|
||||
cd "$project_root"
|
||||
|
||||
echo "Updating lockfile..."
|
||||
uv lock
|
||||
|
||||
echo "Copying reference documentation from Ruff..."
|
||||
cp ruff/crates/ty/docs/cli.md ./docs/reference/
|
||||
cp ruff/crates/ty/docs/configuration.md ./docs/reference/
|
||||
cp ./ruff/crates/ty/docs/rules.md ./docs/reference/
|
||||
|
||||
echo "Documentation has been copied from Ruff submodule"
|
|
@ -46,11 +46,5 @@ cd "$project_root"
|
|||
uv run --only-group release \
|
||||
rooster release "$@"
|
||||
|
||||
echo "Updating lockfile..."
|
||||
uv lock
|
||||
|
||||
echo "Copying reference documentation from Ruff..."
|
||||
cp ruff/crates/ty/docs/cli.md ./docs/reference/
|
||||
cp ruff/crates/ty/docs/configuration.md ./docs/reference/
|
||||
cp ./ruff/crates/ty/docs/rules.md ./docs/reference/
|
||||
"${script_root}/autogenerate_files.sh"
|
||||
git add ./docs/reference
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue