File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 57
57
with :
58
58
style : file
59
59
files-changed-only : false
60
+ cache : true
60
61
# to ignore all build folder contents
61
62
ignore : build|venv
62
63
database : build
Original file line number Diff line number Diff line change @@ -55,6 +55,11 @@ inputs:
55
55
[re-running jobs or workflows](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs).
56
56
required : false
57
57
default : info
58
+ cache :
59
+ description : |
60
+ This controls if the python virtual environment is cached.
61
+ required : false
62
+ default : false
58
63
lines-changed-only :
59
64
description : |
60
65
This controls what part of the files are analyzed. The following values are accepted:
@@ -234,6 +239,21 @@ runs:
234
239
fi
235
240
fi
236
241
242
+ - if : ${{ inputs.cache == 'true' }}
243
+ id : gen-cache-key
244
+ shell : python {0}
245
+ run : |
246
+ import hashlib, os, pathlib
247
+ bytes = pathlib.Path(os.path.join(os.environ["GITHUB_ACTION_PATH"], 'requirements.txt')).read_bytes()
248
+ print('::set-output hash=%s' % (hashlib.sha1(bytes).hexdigest()))
249
+
250
+ - uses : actions/cache@v4
251
+ if : ${{ inputs.cache == 'true' }}
252
+ with :
253
+ key : cpp-linter-action-venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ steps.gen-cache-key.outputs.hash }}
254
+ restore-keys : cpp-linter-action-venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-
255
+ path : ${{ github.action_path }}/venv
256
+
237
257
- name : Setup python venv (Unix)
238
258
if : runner.os == 'Linux' || runner.os == 'macOS'
239
259
shell : bash
You can’t perform that action at this time.
0 commit comments