Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icyleaf/cloudflare-workers-kv-action
A GitHub action to Put and get values from Cloudflare Workers KV action.
https://github.com/icyleaf/cloudflare-workers-kv-action
actions cloudflare github-actions
Last synced: 23 days ago
JSON representation
A GitHub action to Put and get values from Cloudflare Workers KV action.
- Host: GitHub
- URL: https://github.com/icyleaf/cloudflare-workers-kv-action
- Owner: icyleaf
- Created: 2022-06-16T06:42:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-29T02:00:24.000Z (8 months ago)
- Last Synced: 2024-10-09T16:01:46.819Z (about 1 month ago)
- Topics: actions, cloudflare, github-actions
- Language: JavaScript
- Homepage:
- Size: 5.65 MB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cloudflare Workers KV Action
A GitHub action to Put and get values from Cloudflare Workers KV action.
## Usage
Needs [API Token](https://dash.cloudflare.com/profile/api-tokens) (User Profile 'API Tokens' page) to create one with `Account.Workers KV Storage: Edit` scope role.
## Example workflow
```yml
- name: Fetch repo git commit
id: git-commit
working-directory: /workdir
run: |
cd $GITHUB_WORKSPACE/openwrt
GIT_SHA=$(git rev-parse HEAD)
echo "openwrt git commit: ${GIT_SHA}"
echo "::set-output name=sha::${GIT_SHA}"- name: Fetch cached git commit else store it
uses: icyleaf/[email protected]
id: cache-git-commit
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
with:
namespace_id: ${{ secrets.CLOUDFLARE_NAMESPACE_ID }}
key: ${{ runner.os }}-repo-git-commit
value: ${{ steps.git-commit.outputs.sha }}- name: Store current git commit
uses: icyleaf/[email protected]
if: steps.git-commit.outputs.sha != steps.cache-git-commit.outputs.value
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
with:
namespace_id: ${{ secrets.CLOUDFLARE_NAMESPACE_ID }}
key: ${{ runner.os }}-git-commit
value: ${{ steps-git-commit.outputs.sha }}
overwrite: true
```