openrewrite / rewrite-github-actions

OpenRewrite recipes for performing GitHub action hygiene and migration tasks.
Apache License 2.0
9 stars 10 forks source link

Upgrade Python version used in actions/setup-python #85

Open timtebeek opened 1 year ago

timtebeek commented 1 year ago

What problem are you trying to solve?

When upgrading to newer versions of Python, we should also upgrade the Python version used in GitHub Actions setup-python. We already have a similar recipe for Java: SetupJavaUpgradeJavaVersion

What precondition(s) should be checked before applying this recipe?

actions/setup-python is used at all, with a python-version who's value or range does not match the target Python version.

Describe the situation before applying the recipe

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
  with:
    python-version: '3.10' 
- run: python my_script.py

Describe the situation after applying the recipe

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
  with:
    python-version: '3.11' 
- run: python my_script.py

Have you considered any alternatives or workarounds?

No.

Any additional context

Might want to make sure we don't set a version when python-version-file is in use.

https://github.com/openrewrite/rewrite-migrate-python/issues/6