Skip to content

Commit

Permalink
feat(GitHub-Actions): Upgrade to latest versions
Browse files Browse the repository at this point in the history
Eliminate the need to hard-code the Python version used by the action by
leveraging setup-python's newly added support for reading the Python
version from a file.

actions/setup-python v3.1.2 --> v4.0.0
  • Loading branch information
Kurt-von-Laven committed Jun 11, 2022
1 parent 815b145 commit 16316e7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ default_install_hook_types:
- pre-merge-commit
- pre-push
default_language_version:
# Keep in sync with .tool-versions, action.yaml, and pyproject.toml.
python: python3.9.7
python: python3.9.7 # Keep in sync with .tool-versions and pyproject.toml.
default_stages:
- commit
- push
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodejs 16.15.0
python 3.9.7 # Keep in sync with .pre-commit-config.yaml, action.yaml, and pyproject.toml.
python 3.9.7 # Keep in sync with .pre-commit-config.yaml and pyproject.toml.
poetry 1.1.13
18 changes: 12 additions & 6 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ branding:
runs:
using: composite
steps:
- name: Set up Python.
uses: actions/setup-python@v3.1.2
with:
# Keep in sync with .pre-commit-config.yaml, .tool-versions, and
# pyproject.toml.
python-version: 3.9.7
- name: Write Python version file based on asdf Python version.
run: >
grep
--perl-regexp
--only-matching
"(?<=python )(\d+\.){2}\d+"
.tool-versions
>.python-version
shell: bash
working-directory: "${{ github.action_path }}"
- name: Set up Python based on Python version file.
uses: actions/setup-python@v4.0.0
- name: Configure Slack notification.
run: >
python set_slack_message.py
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build-backend = "poetry.core.masonry.api"
license = "MIT"

[tool.poetry.dependencies]
# Keep in sync with .pre-commit-config.yaml, .tool-versions, and action.yaml.
# Keep in sync with .pre-commit-config.yaml and .tool-versions.
python = "^3.9.7"

[tool.poetry.dev-dependencies]
Expand Down

0 comments on commit 16316e7

Please sign in to comment.