From 16316e7d4bf08a1bd355aaf21dad03d40a1650f6 Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Fri, 10 Jun 2022 01:00:06 -0700 Subject: [PATCH] feat(GitHub-Actions): Upgrade to latest versions 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 --- .pre-commit-config.yaml | 3 +-- .tool-versions | 2 +- action.yaml | 18 ++++++++++++------ pyproject.toml | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d79a468..dd24dd5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/.tool-versions b/.tool-versions index 797864a..9bb693c 100644 --- a/.tool-versions +++ b/.tool-versions @@ -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 diff --git a/action.yaml b/action.yaml index edf7c62..533c88b 100644 --- a/action.yaml +++ b/action.yaml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 0f04c8b..9cf31ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]