From 58d420a3422f325f5800c963d1250eed8c982e86 Mon Sep 17 00:00:00 2001 From: Aayush Date: Sun, 24 Nov 2024 15:30:20 -0500 Subject: [PATCH] update README --- .github/workflows/build.yaml | 5 -- LICENSE | 37 +++++------ README.md | 116 ++++++++++------------------------- 3 files changed, 51 insertions(+), 107 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fe5c614..c497f0b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,11 +20,6 @@ jobs: - name: Install Dependencies run: npm ci - - name: Check Formatting - run: | - npm run format - git diff && git diff-index --quiet --exit-code HEAD - - name: Check Lint run: npm run lint diff --git a/LICENSE b/LICENSE index 68a49da..dc9e9a4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,24 +1,21 @@ -This is free and unencumbered software released into the public domain. +MIT License -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. +Copyright (c) 2024 Aayush Shah -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -For more information, please refer to +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index f04386b..dd7e2a4 100644 --- a/README.md +++ b/README.md @@ -1,101 +1,53 @@ - +# Delete Blacksmith Cache Action -# Action Starter - -A minimalist template for starting a new [GitHub Action](https://github.com/features/actions) project. - -This template provides a basic GitHub Action project containing a sample [JavaScript action](https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-javascript-action) written in [TypeScript](https://www.typescriptlang.org/), with built-in support for formatting, linting, testing, and continuous integration. - -## Key Features - -- Minimal GitHub Action project written in TypeScript with [ESM](https://nodejs.org/api/esm.html) support. -- Uses [Yarn](https://yarnpkg.com/) as the package manager with [Plug'n'Play](https://yarnpkg.com/features/pnp) support. -- Supports formatting with [Prettier](https://prettier.io/), linting with [ESLint](https://eslint.org/), and testing with [Jest](https://jestjs.io/). -- Preconfigured workflows for [Dependabot](https://docs.github.com/en/code-security/dependabot) and [GitHub Actions](https://github.com/features/actions). +A GitHub Action to delete caches from Blacksmith's cache storage. This action allows you to delete either a specific cache version or all versions of a cache key. ## Usage -This guide explains how to use this template to start a new GitHub Action project, from creation to release. - -### Create a New Project - -Follow [this link](https://github.com/new?template_name=action-starter&template_owner=threeal) to create a new project based on this template. For more information about creating a repository from a template on GitHub, refer to [this documentation](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template). - -Alternatively, you can clone this repository locally to begin using this template. - -### Choose a License - -By default, this template is [unlicensed](https://unlicense.org/). Before modifying this template, replace the [`LICENSE`](./LICENSE) file with the license to be used by the new project. For more information about licensing a repository, refer to [this documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository). - -Alternatively, you can remove the `LICENSE` file or leave it as-is to keep the new project unlicensed. - -### Update Project Information - -To replace the sample information in this template with details about your new project, complete the following steps: - -- Replace the content of this [`README.md`](./README.md) file with a description of the new project. For more information on adding READMEs to a project, refer to [this documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes). -- Modify the action metadata in the [`action.yml`](./action.yml) file according to the new project specifications. For more details on the action metadata, refer to [this documentation](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions). - -> Note: You can also search for `TODO` comments for a list of information that needs to be replaced. - -### Set Up Tools - -It is recommended to use [nvm](https://github.com/nvm-sh/nvm) to manage the Node.js version in the project. By default, this template uses the Node.js version specified in the [`.nvmrc`](./.nvmrc) file. Use the following command to install and use the correct Node.js version with nvm: - -```sh -nvm install -``` - -This template uses [Yarn](https://yarnpkg.com/) with [Plug'n'Play](https://yarnpkg.com/features/pnp) support as the package manager. If Yarn is not yet enabled, run the following command: - -```sh -corepack enable yarn -``` - -Then, install the project dependencies with: - -```sh -yarn install +```yaml +- name: Delete Cache + uses: useblacksmith/cache-delete@v1 + with: + key: Linux-composer-ecf6e2e236589e4d34ba89662b6bc2afe8e15237cd19a13df9dc0cb599ff4826 + version: v213asda2cf # Optional: specific version to delete ``` -For more information on Yarn, such as adding dependencies or running tools, refer to [this documentation](https://yarnpkg.com/getting-started). +## Inputs -### Developing the Action +| Input | Description | Required | +| --------- | --------------------------------------- | -------- | +| `key` | The cache key to delete | Yes | +| `version` | Specific version of the cache to delete | No | -Write the logic for the action in the [`src/main.ts`](./src/main.ts) file according to the project requirements. If you're new to [TypeScript](https://www.typescriptlang.org/), refer to [this documentation](https://www.typescriptlang.org/docs/) for guidance. +## Examples -If the action will support pre- and post-steps, additional files like `src/pre.ts` and `src/post.ts` can be added. Just make sure to update the Rollup configuration in the [`rollup.config.js`](./rollup.config.js) file and the action metadata in the [`action.yml`](./action.yml) file. +### Delete All Versions of a Cache -Once the code is written, format it with: - -```sh -yarn format -``` - -Then, check linting with: - -```sh -yarn lint +```yaml +- name: Delete All Cache Versions + uses: useblacksmith/cache-delete@v1 + with: + key: npm-cache ``` -Lastly, build and bundle the action files with: +### Delete a Specific Cache Version -```sh -yarn build +```yaml +- name: Delete Specific Cache Version + uses: useblacksmith/cache-delete@v1 + with: + key: npm-cache + version: v1.0 ``` -### Testing the Action +## Error Handling -Test files in this template are named `*.test.ts` and typically correspond to the source files being tested. This template uses [Jest](https://jestjs.io/) as the testing framework. For more information on testing with Jest, refer to [this documentation](https://jestjs.io/docs/getting-started). - -After creating your test files, run tests with: - -```sh -yarn test -``` +The action will: -Additionally, you can test the action by running it directly from the GitHub workflow as specified in the [`.github/workflows/test.yaml`](./.github/workflows/test.yaml) file. +- Fail if the cache deletion request fails (non-404 error) +- Log a message if the cache is not found (404) +- Successfully complete if the cache is deleted -### Release the Action +## License -When the project is complete, release and publish it from the project repository page on GitHub. For more information on releasing a project, refer to [this documentation](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases). For more information on publishing GitHub actions, refer to [this documentation](https://docs.github.com/en/actions/sharing-automations/creating-actions/publishing-actions-in-github-marketplace). +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.