Skip to content

Commit c7b78be

Browse files
committed
feat: don't use action-setup-tools
BREAKING CHANGE: The action no longer uses action-setup-tools. The action was already installing python via setup-python, so this is no longer needed. If any step running after this action required other tools being installed, they will need to be installed outside of this action
1 parent e2db05a commit c7b78be

File tree

2 files changed

+14
-37
lines changed

2 files changed

+14
-37
lines changed

action.yaml

+7-37
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,6 @@ runs:
3131
- name: Version files
3232
shell: bash
3333
run: |
34-
# Find Node and Python versions
35-
36-
# Try to use local repo .node-version
37-
NODE_VERSION="${NODE_VERSION:-$(cat ".node-version" || true)}"
38-
# Try to use existing version
39-
NODE_VERSION="${NODE_VERSION:-$(node --version || true)}"
40-
# Try to use action default version
41-
NODE_VERSION="${NODE_VERSION:-$(cat "$GITHUB_ACTION_PATH/.node-version")}"
42-
# Write back the file if it doesn't exist
43-
[[ -f .node-version ]] || { echo "${NODE_VERSION#v}" > .node-version; echo "CLEAN_NODE_VERSION=true" >> "$GITHUB_ENV"; }
44-
echo "NODE_VERSION=${NODE_VERSION}" >> "$GITHUB_ENV"
45-
46-
# Try to use local repo .python-version
47-
PYTHON_VERSION="${PYTHON_VERSION:-$(cat ".python-version" || true)}"
48-
# Try to use existing version
49-
PYTHON_VERSION="${PYTHON_VERSION:-$(python --version || true)}"
50-
# Try to use action default version
51-
PYTHON_VERSION="${PYTHON_VERSION:-$(cat "$GITHUB_ACTION_PATH/.python-version")}"
52-
# Strip leading "Python " if it exists
53-
PYTHON_VERSION="${PYTHON_VERSION//Python /}"
54-
# Write back the file if it doesn't exist
55-
[[ -f .python-version ]] || { echo "${PYTHON_VERSION#v}" > .python-version; echo "CLEAN_PYTHON_VERSION=true" >> "$GITHUB_ENV"; }
56-
echo "PYTHON_VERSION=${PYTHON_VERSION}" >> "$GITHUB_ENV"
57-
5834
# Finding pre-commit
5935
# This will set an environment variable we can use to conditionally
6036
# install pre-commit if needed and toggle how the action runs.
@@ -70,14 +46,15 @@ runs:
7046
# Only run this if we don't already have a pre-commit on the PATH
7147
if: env.PYTHON_BIN == null && env.PRE_COMMIT_BIN == null && steps.pre-commit-config.outputs.exists != 'false'
7248
uses: actions/setup-python@v5
49+
- name: Setup node
50+
uses: actions/setup-node@v4
7351
with:
74-
python-version: ${{ env.PYTHON_VERSION }}
75-
- name: Install tools
76-
# This will skip the (slow) pyenv install if we triggered the above
77-
uses: open-turo/action-setup-tools@v1
52+
# Default to node 20 but use the .node-version file if it exists in the consumer repo
53+
node-version: "20"
54+
node-version-file: .node-version
7855
- name: Commitlint
7956
# This version needs to be sync'd with the repo HEAD if a major version is cut
80-
uses: open-turo/action-pre-commit/commitlint@v2
57+
uses: open-turo/action-pre-commit/commitlint@f/make_action_pre_commit_faster
8158
with:
8259
restore-config: "false"
8360
config-file: ${{ inputs.config-file }}
@@ -98,21 +75,14 @@ runs:
9875
- name: Pre-commit (action)
9976
# Same as above, this will install and run pre-commit for us
10077
if: env.PRE_COMMIT_BIN == null && steps.pre-commit-config.outputs.exists != 'false'
101-
uses: pre-commit/action@v3.0.0
78+
uses: pre-commit/action@v3.0.1
10279
with:
10380
extra_args: ${{ env.PRE_COMMIT_ARGS }}
10481
- name: Pre-commit (from PATH)
10582
# Run pre-commit directly if we found it on the PATH
10683
if: env.PRE_COMMIT_BIN != null && steps.pre-commit-config.outputs.exists != 'false'
10784
shell: bash
10885
run: pre-commit run --show-diff-on-failure --color=always ${{ env.PRE_COMMIT_ARGS }}
109-
- name: Clean up version files
110-
if: always()
111-
shell: bash
112-
run: |
113-
# Clean up version files if we wrote them
114-
[[ "${{ env.CLEAN_PYTHON_VERSION }}" == "" ]] || rm .python-version
115-
[[ "${{ env.CLEAN_NODE_VERSION }}" == "" ]] || rm .node-version
11686
- name: Restore commitlint config
11787
if: always() && hashFiles(inputs.config-file) != '' && inputs.turo-conventional-commit == 'true'
11888
shell: bash

docs/breaking-changes/v3.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Breaking changes in v3
2+
3+
This action no longer uses `open-turo/action-setup-tools` as it doesn't need it. If any step that runs
4+
after this action was relying on tools installed by `open-turo/action-setup-tools`, it will need to be
5+
manually added.
6+
7+
Refer to the [README](https://github.com/open-turo/action-setup-tools) for how to use this action.

0 commit comments

Comments
 (0)