File tree 2 files changed +22
-0
lines changed
2 files changed +22
-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,22 @@ 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
+ fp = pathlib.Path(os.path.join(os.environ["GITHUB_ACTION_PATH"], 'requirements.txt'))
248
+ with open(os.environ["GITHUB_OUTPUT"], "a") as f:
249
+ print('hash=%s' % (hashlib.sha1(fp.read_bytes()).hexdigest()), file=f)
250
+
251
+ - uses : actions/cache@v4
252
+ if : ${{ inputs.cache == 'true' }}
253
+ with :
254
+ key : cpp-linter-action-venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ steps.gen-cache-key.outputs.hash }}
255
+ restore-keys : cpp-linter-action-venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-
256
+ path : ${{ github.action_path }}/venv
257
+
237
258
- name : Setup python venv (Unix)
238
259
if : runner.os == 'Linux' || runner.os == 'macOS'
239
260
shell : bash
You can’t perform that action at this time.
0 commit comments