Skip to content

Commit

Permalink
🚸 Make the default keys version-dependent from code
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Jul 18, 2023
1 parent 9a2e0b6 commit 4f28476
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ with:
| `artifact-name` | Specify Qodana results artifact name, used for results uploading. Optional. | `qodana-report` |
| `cache-dir` | Directory to store Qodana cache. Optional. | `${{ runner.temp }}/qodana/caches` |
| `use-caches` | Utilize [GitHub caches](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy) for Qodana runs. Optional. | `true` |
| `primary-cache-key` | Set [the primary cache key](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key). Optional. | `qodana-2023.1-${{ github.ref }}-${{ github.sha }}` |
| `additional-cache-key` | Set [the additional cache key](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key). Optional. | `qodana-2023.1-${{ github.ref }}` |
| `primary-cache-key` | Set [the primary cache key](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key). Optional. | `qodana-2023.2-${{ github.ref }}-${{ github.sha }}` |
| `additional-cache-key` | Set [the additional cache key](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key). Optional. | `qodana-2023.2-${{ github.ref }}` |
| `cache-default-branch-only` | Upload cache for the default branch only. Optional. | `false` |
| `use-annotations` | Use annotation to mark the results in the GitHub user interface. Optional. | `true` |
| `pr-mode` | Analyze ONLY changed files in a pull request. Optional. | `true` |
Expand Down
4 changes: 2 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ inputs:
primary-cache-key:
description: 'Set the primary cache key'
required: false
default: "qodana-2023.1-${{ github.ref }}-${{ github.sha }}"
default: ""
additional-cache-key:
description: 'Set the additional cache key'
required: false
default: "qodana-2023.1-${{ github.ref }}"
default: ""
additional-cache-hash:
description: 'Pass additional cache hash extension'
required: false
Expand Down
4 changes: 2 additions & 2 deletions scan/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69166,8 +69166,8 @@ var require_utils8 = __commonJS({
args: core2.getInput("args").split(",").map((arg) => arg.trim()),
resultsDir: core2.getInput("results-dir"),
cacheDir: core2.getInput("cache-dir"),
primaryCacheKey: core2.getInput("primary-cache-key"),
additionalCacheKey: core2.getInput("additional-cache-key") || core2.getInput("additional-cache-hash"),
primaryCacheKey: core2.getInput("primary-cache-key") || `qodana-${qodana_12.VERSION}-${process.env.GITHUB_REF}-${process.env.GITHUB_SHA}`,
additionalCacheKey: core2.getInput("additional-cache-key") || core2.getInput("additional-cache-hash") || `qodana-${qodana_12.VERSION}-${process.env.GITHUB_REF}}-`,
cacheDefaultBranchOnly: core2.getBooleanInput("cache-default-branch-only"),
uploadResult: core2.getBooleanInput("upload-result"),
uploadSarif: false,
Expand Down
7 changes: 5 additions & 2 deletions scan/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ export function getInputs(): Inputs {
.map(arg => arg.trim()),
resultsDir: core.getInput('results-dir'),
cacheDir: core.getInput('cache-dir'),
primaryCacheKey: core.getInput('primary-cache-key'),
primaryCacheKey:
core.getInput('primary-cache-key') ||
`qodana-${VERSION}-${process.env.GITHUB_REF}-${process.env.GITHUB_SHA}`,
additionalCacheKey:
core.getInput('additional-cache-key') ||
core.getInput('additional-cache-hash'),
core.getInput('additional-cache-hash') ||
`qodana-${VERSION}-${process.env.GITHUB_REF}}-`,
cacheDefaultBranchOnly: core.getBooleanInput('cache-default-branch-only'),
uploadResult: core.getBooleanInput('upload-result'),
uploadSarif: false, // not used by the action
Expand Down

0 comments on commit 4f28476

Please sign in to comment.