Skip to content

Commit d698a66

Browse files
committed
feat(action): enable cache
1 parent ae5fa3e commit d698a66

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

action.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,43 @@ inputs:
1414
extra_requirements:
1515
description: "Install extra dependencies"
1616
required: false
17+
cache:
18+
description: 'Cache commitizen installation, set to "true" to enable'
19+
required: false
20+
default: "false"
1721

1822
runs:
1923
using: "composite"
2024
steps:
21-
- uses: actions/setup-python@v6
2225
- id: set-vars
2326
shell: python
2427
env:
2528
COMMITIZEN_VERSION: ${{ inputs.version }}
29+
CACHE: ${{ inputs.cache }}
2630
run: |
2731
import os
32+
33+
# Set commitizen version
2834
commitizen_version = os.environ.get("COMMITIZEN_VERSION", "").strip()
2935
if commitizen_version == "latest":
3036
set_commitizen_version = ""
3137
else:
3238
set_commitizen_version = f"=={commitizen_version}"
39+
40+
# Set python cache
41+
cache = os.environ.get("CACHE", "")
42+
if cache == True or cache == "true":
43+
set_cache = "pip"
44+
else:
45+
set_cache = ""
46+
47+
# Write outputs
3348
with open(os.environ["GITHUB_OUTPUT"], "a") as fh:
3449
fh.write(f"COMMITIZEN_VERSION={set_commitizen_version}\n")
50+
fh.write(f"PYTHON_CACHE={set_cache}\n")
51+
- uses: actions/setup-python@v6
52+
with:
53+
cache: ${{ steps.set-vars.outputs.PYTHON_CACHE }}
3554
- name: Install commitizen
3655
shell: bash
3756
env:

0 commit comments

Comments
 (0)