Skip to content

Commit 6c2278d

Browse files
committed
ci: harden regenerate version bump in CI
Fetch tags/history during checkout and pass --current-version from pyproject.toml so bump-my-version does not fail in shallow environments.
1 parent 4132fa9 commit 6c2278d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

.github/workflows/regenerate.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1919
with:
2020
token: ${{ steps.app-token.outputs.token }}
21+
fetch-depth: 0
22+
fetch-tags: true
2123

2224
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
2325
with:
@@ -40,7 +42,8 @@ jobs:
4042
id: pkg
4143
run: |
4244
python3 -m pip install --quiet bump-my-version
43-
bump-my-version bump patch --no-commit --no-tag --allow-dirty
45+
current_version=$(python3 -c "import tomllib,pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")
46+
bump-my-version bump patch --current-version "$current_version" --no-commit --no-tag --allow-dirty
4447
version=$(bump-my-version show current_version)
4548
echo "version=$version" >> "$GITHUB_OUTPUT"
4649

0 commit comments

Comments
 (0)