Skip to content

Commit

Permalink
docs: improve accuracy of description
Browse files Browse the repository at this point in the history
Signed-off-by: Mogyuchi <[email protected]>
  • Loading branch information
Mogyuchi committed Jan 25, 2024
1 parent b545b2f commit 487b2f9
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
[![Check dist/](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml)
[![CodeQL](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml)

Souji Action deletes all GitHub Actions Caches created for branches related to
the context of the triggered workflow event.
Souji Action is a GitHub Action that deletes both the head ref and merge ref
caches without any configuration.

## Usage

`actions:write` permission is
[required to delete caches](https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id).

```yml
name: cleanup caches by a branch
on:
pull_request:
pull_request_target:
types:
- closed
delete:

jobs:
cleanup:
Expand All @@ -29,8 +31,14 @@ jobs:
uses: 4m-mazi/souji-action@v1 # Check and specify the latest version
```
For instance, when a Pull Request created in the branch `feat/awesome-feature`
is "merged" or "closed," a workflow event is triggered and the workflow is
executed. At this time, all GitHub Actions Caches created under the merge ref
`refs/pull/{pull_request_number}/merge` and the head ref
`refs/heads/feat/awesome-feature` are deleted.
This workflow cleans up caches for branches when they are merged(closed) or
deleted.
This will clear the following cache:
- merge ref `refs/pull/<number>/merge`
- When a pull request is merged or closed, this workflow removes cached data
associated with the merge ref.
- branch `<branch name>`
- When a branch is deleted, this workflow deletes the cached data associated
with the branch.

0 comments on commit 487b2f9

Please sign in to comment.