Skip to content

Commit 9bbc457

Browse files
committed
BREAKING CHANGE: Require 'cache_key' input
1 parent 646190d commit 9bbc457

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Trigger the workflow manually or automatically based on your configuration. The
9696
| `urls` | Yes | Newline-delimited list of URLs to scan | `https://primer.style`<br>`https://primer.style/octicons` |
9797
| `repository` | Yes | Repository (with owner) for issues and PRs | `primer/primer-docs` |
9898
| `token` | Yes | PAT with write permissions (see above) | `${{ secrets.GH_TOKEN }}` |
99-
| `cache_key` | No | Custom key for caching findings across runs<br>Allowed: `A-Za-z0-9._/-` | `cached_findings-main-primer.style.json` |
99+
| `cache_key` | Yes | Key for caching findings across runs<br>Allowed: `A-Za-z0-9._/-` | `cached_findings-main-primer.style.json` |
100100
| `login_url` | No | If scanned pages require authentication, the URL of the login page | `https://github.com/login` |
101101
| `username` | No | If scanned pages require authentication, the username to use for login | `some-user` |
102102
| `password` | No | If scanned pages require authentication, the password to use for login | `correct-horse-battery-staple` |

action.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ inputs:
1313
description: "Personal access token (PAT) with fine-grained permissions 'contents: write', 'issues: write', and 'pull_requests: write'"
1414
required: true
1515
cache_key:
16-
description: "Custom key for caching findings across runs"
17-
required: false
16+
description: "Key for caching findings across runs"
17+
required: true
1818
login_url:
1919
description: "If scanned pages require authentication, the URL of the login page"
2020
required: false
@@ -35,21 +35,11 @@ inputs:
3535
runs:
3636
using: "composite"
3737
steps:
38-
- name: Generate cache key
39-
id: cache_key
40-
shell: bash
41-
run: |
42-
CACHE_KEY="${{ inputs.cache_key }}"
43-
if [[ -z "$CACHE_KEY" ]]; then
44-
# If cache_key is not provided, generate a default one using the branch name, replacing characters (e.g. `/`) which would create unexpected paths.
45-
CACHE_KEY=$(printf 'cached_findings-%s' "${{ github.ref_name }}" | tr -cs 'A-Za-z0-9._-' '_')
46-
fi
47-
echo "cache_key=$CACHE_KEY" >> $GITHUB_OUTPUT
4838
- name: Restore cached_findings
4939
id: restore
5040
uses: ./.github/actions/gh-cache/cache
5141
with:
52-
key: ${{ steps.cache_key.outputs.cache_key }}
42+
key: ${{ inputs.cache_key }}
5343
token: ${{ inputs.token }}
5444
- if: ${{ inputs.login_url && inputs.username && inputs.password && !inputs.auth_context }}
5545
name: Authenticate
@@ -84,7 +74,7 @@ runs:
8474
- name: Save cached_findings
8575
uses: ./.github/actions/gh-cache/cache
8676
with:
87-
key: ${{ steps.cache_key.outputs.cache_key }}
77+
key: ${{ inputs.cache_key }}
8878
value: ${{ steps.file.outputs.findings }}
8979
token: ${{ inputs.token }}
9080

0 commit comments

Comments
 (0)