Skip to content

Commit

Permalink
Merge pull request #186 from rmartin16/selective-bump
Browse files Browse the repository at this point in the history
Exclude pyproject.toml from dependency version bumps
  • Loading branch information
freakboy3742 authored Nov 18, 2024
2 parents 7d72296 + 309ce7e commit b02dffb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/dep-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
description: "Whitespace-delimited list of directories containing pyproject.toml and tox.ini files; defaults to repo's base directory."
default: ""
type: string
filenames:
description: "Whitespace-delimited list of filenames to evaluate for dependency version bumps; defaults to only tox.ini."
default: "tox.ini"
type: string
create-changenote:
description: "Defaults 'true' to create a misc changenote in the './changes' directory."
default: true
Expand Down Expand Up @@ -83,10 +87,10 @@ jobs:
working-directory: "repo"
run: |
if [ "${{ inputs.subdirectory }}" == "" ]; then
python ../beeware-.github/scripts/bump_versions.py
python ../beeware-.github/scripts/bump_versions.py --filenames ${{ inputs.filenames }}
else
for SUBDIR in ${{ inputs.subdirectory }}; do
python ../beeware-.github/scripts/bump_versions.py ${SUBDIR}
python ../beeware-.github/scripts/bump_versions.py ${SUBDIR} --filenames ${{ inputs.filenames }}
done
fi
Expand Down
16 changes: 14 additions & 2 deletions scripts/bump_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ def parse_args():
"defaults to current directory"
),
)
parser.add_argument(
"--filenames",
default="",
nargs="+",
choices=["tox.ini", "pyproject.toml"],
help=(
"One or more filenames to evaluate. "
"All supported files are evaluated if not specified."
),
)

args = parser.parse_args()
print(f"\nEvaluating {args.subdirectory}")
Expand Down Expand Up @@ -196,8 +206,10 @@ def main():
ret_code = 0
try:
args = parse_args()
update_pyproject_toml(base_dir=args.subdirectory)
update_tox_ini(base_dir=args.subdirectory)
if not args.filenames or "pyproject.toml" in args.filenames:
update_pyproject_toml(base_dir=args.subdirectory)
if not args.filenames or "tox.ini" in args.filenames:
update_tox_ini(base_dir=args.subdirectory)
except BumpVersionError as e:
print(e.msg)
ret_code = e.error_no
Expand Down

0 comments on commit b02dffb

Please sign in to comment.